I'm trying my luck with a Mozilla extension.
I want to use the below code to read line by line from a file and store the content in an array. And I've been trying to use workers to do this task in the background, away from the main thread. The problem I'm facing is that I can't seem to pass neither "Components" nor the input stream to the worker in the postMessage()
function without receiving a DataCloneError
error.
https://developer.mozilla.org/en-US/docs/Code_snippets/File_I_O#Line_by_line
Any ideas on how and what to pass to the worker to make it work ? Or if not, then how to do this task asynchronously, if not by using workers ?