Pass large amounts of data between web worker and main thread

后端 未结 2 1195
你的背包
你的背包 2020-12-14 18:27

Is there a way to pass large amounts of data (multiple MB) between a web worker and the main thread? I work in a project where I need to download files, modify them a bit an

2条回答
  •  春和景丽
    2020-12-14 18:48

    According to this WebWorkers tutorial, WebWorkers now support to pass File and Blob objects and basically any object that can be used with the structured clone algorith... or at least Chrome does it, probably because it implments the FileSystem API. I don't know if it's the main reason but I hope don't and in fact this feature is implemented in other browsers... being able to process user selected files in background is a nice thing.

提交回复
热议问题