I want to transfer a file from a form to a web worker. In chrome i simple, you can use this code to transfer a FileList-Object:
worker.postMessage(files: array_files);
But with Firefox, I get this error:
Transfer file to webworker: DataCloneError: The object could not be cloned.
So, I tried using Syntax for portable objects. Something like that?
var post = {files: array_files, file_ids: response.file_ids}; worker.postMessage(post, [post]);
But with this I get it in Chrome
Uncaught DataCloneError: Failed to execute 'postMessage' on 'Worker': Value at index 0 does not have a transferable type.
And further
DataCloneError: The object could not be cloned.
in Firefox.
What is the correct way to pass a FileList to an employee?
source share