-
-
Notifications
You must be signed in to change notification settings - Fork 421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The 102 version is normal. After Firefox is upgraded to 103 or a later version, the file fails to be exported because the stream writing is abnormal. As a result, the file download is incomplete. #292
Comments
I'm facing this issue too, tried the solution for that one #290 but still the same. |
中文:控制台报错: 无法载入‘’。某个 ServiceWorker 拦截了请求并遇到未知错误; |
Any update on this matter? Someone managed to workaround it? |
the download stops at 1.5 gb in firefox |
When I'm downloading a 500m file using firefox, the function pipeTo doesn't return any information。 const fileStream = streamsaver.createWriteStream(title);
const readableStream = response.body;
if (readableStream) {
if (readableStream.pipeTo) {
return readableStream.pipeTo(fileStream)
.then(() => {
// downloading big files will not executed here
});
.catch(error => {
// downloading big files will not executed here
})
}
// Only when downloading small files will it be executed here
const writer = fileStream.getWriter();
const reader = readableStream.getReader();
const pump = async () => reader.read()
.then((res: any) => res.done
? writer.close()
: writer.write(res.value).then(pump));
await pump(); firefox:v107.0.1,streamsaver:v2.0.6,web-streams-polyfil:v3.2.1 The same code is normal in chrome |
seems like browser are taking extra measure to prevent 3th party origin to download stuff from service worker coming from another domain... firefox may be even more restrict nowdays... guess the best corse of action is to provide a guide of how to download stuff using self hosted service worker...
maybe this ☝️ can help solve the Firefox problem? |
I am using this code to write data comming in chunks from another user on a peer-to-peer connection, it works fine in chrome and is able to handle large file but when used in firefox as receiving end the file dounload fails at 1.5 gb. function helperReceiveFile(e) {
// console.log("ooooo");
if (!fileStream.current && e.data.toString().includes("start")) {
fileStream.current = streamsaver.createWriteStream(JSON.parse(e.data).fileName,{size:JSON.parse(e.data).size});
console.log("fileStream.current--->", fileStream.current);
// alert("jskdhjfhk")
console.log(JSON.parse(e.data).fileName);
fileStreamWriter.current = fileStream.current.getWriter();
console.log("fileStreamWriter.current--->", fileStreamWriter.current);
return;
}
handleReceiveFile(e)
}
function handleReceiveFile(e) {
// console.log(e);
if (e.data.toString().includes("done")) {
setGotFile(true);
console.log(e);
fileStreamWriter.current.close();
fileStream.current = null;
fileName.current = JSON.parse(e.data).fileName;
} else {
// console.log(e.data);
fileStreamWriter.current.write(new Uint8Array(e.data)).catch(e=>{
console.log("error",e);
})
// worker.postMessage(e.data);
}
} I want to handle large files so i have to write the data directly in disk. |
if your server spport HTTP range,you can try to split your download and still able to write the all the response to one file. |
I've noticed that Firefox doesn't prematurely kill the Service Worker process when the Firefox Devtools have the |
…streams in Firefox
It seems that #305 should fix this issue. |
Compared with the 102 version 103, the following security vulnerabilities are fixed: https://www.mozilla.org/en-US/security/advisories/mfsa2022-28/
The text was updated successfully, but these errors were encountered: