Closed tomicvladan closed 1 year ago
Using blob, bytes can be converted to base64. But in any case, large files can't be transferred. If a file is too large, it will cause this error:
Error in invocation of runtime.sendMessage(optional string extensionId, any message, optional object options, optional function callback): Message length exceeded maximum allowed length.
@tomicvladan I can suggest other approaches. I don't know if they will work in this case. 1 - IndexedDB - can be used as an intermediate storage location. It seems to support big data. 2 - Message chunking - file can be read the in parts and transfer pieces of 1-5 mb to the extension, collecting a whole file in memory. Then upload the assembled file via fdp-storage.
@tomicvladan I can suggest other approaches. I don't know if they will work in this case. 1 - IndexedDB - can be used as an intermediate storage location. It seems to support big data. 2 - Message chunking - file can be read the in parts and transfer pieces of 1-5 mb to the extension, collecting a whole file in memory. Then upload the assembled file via fdp-storage.
3 - Store data inside SharedWorker and read them peace by peace https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker
Thanks @IgorShadurin, these approaches would work for web pages, but they can't be used for extension.
Fixes the serialization issue.