Hello, I am writing an extension, which modifies certain download requests by splitting them into several smaller requests and stitching the responses together, then pushing the resulting data into the downloads.download API. Currently, I am achieving this by putting all of the response data into a buffer and sending it over to the download manager using a BLOB. However, the data can be very large in common cases and storing all of it in the buffer would consume an unacceptable amount of memory. Streaming would be the ideal solution, but I couldn’t find a way to do it without having the user run a local server on their machine (which is not ideal).
I’ve tried using the webRequest.filterResponseData API on a real download request, but the call returns an “Invalid request ID“ error, since the request is taken over by the download manager. I’ve also tried registering a service worker to act as a “fake server”, which would return a ReadableStream, but it seems like Firefox does not support service workers in web extensions, as mentioned in the documentation.
Thank you in advance.