jimmywarting / StreamSaver.js

StreamSaver writes stream to the filesystem directly asynchronous
https://jimmywarting.github.io/StreamSaver.js/example.html
MIT License
4.01k stars 417 forks source link

StreamSaver on Brave browser #254

Open oulhtak opened 2 years ago

oulhtak commented 2 years ago

Hey Jimmy,

I tried one of the examples and it works fine on Firefox and Chrome as expected but when I tried it on Brave I got the following error :

Error with Permissions-Policy header: Unrecognized feature: 'interest-cohort'.
mitm.html:1 Uncaught (in promise) DOMException: Failed to get a ServiceWorkerRegistration: The user denied permission to use Service Worker.

Any idea what's the reason behind this? Brave is based on the Chromium web browser just like Chrome so it should work, I don't really have any deep knowledge about how browsers works so I cant come up with any idea.

FallingHazard commented 2 years ago

Ye same issue

jimmywarting commented 2 years ago

do you use a custom mitm or the default? do you use http or https? dose our own example work in brave? https://jimmywarting.github.io/StreamSaver.js/example.html

FallingHazard commented 2 years ago

image

wawezz commented 2 years ago

same issue. Error with Permissions-Policy header: Unrecognized feature: 'interest-cohort'.

jimmywarting commented 2 years ago

guess the best corse of action would be to self-host the service worker and change the mitm.html to be your own. or better yet use the new file system access

my adapter is better suited for a self hosted service worker solution as it don't use any mitm approch and communicates directly to the serviced worker

chiahsoon commented 2 years ago

FWIW, enabling all cookies in Brave browser solves the ServiceWorkerRegistration error and allows me to download the file!

gabriels1234 commented 2 years ago

my adapter is better suited for a self hosted service worker solution as it don't use any mitm approch and communicates directly to the serviced worker

Could you elaborate on this theme? how to add the adapter to StreamSaver.js and be able to use fetch to get the files that will be then downloaded as a zip file?

jimmywarting commented 1 year ago

the file system adapter is not something that works along side with streamsaver.js. it's something else entirely. it saves a readable stream pretty much the same way as streamsaver.js dose using a service worker. but it works differently. it's designed around the whatwg/fs & file system access api.

streamsaver.js have been designed to work around the crux of saving a stream using many workarounds for more legacy browsers. eg using a 3th party domain to install a service worker to get around the issue that you can't install them on insecure domains (http). the fact that you also don't need to install any service worker yourself using streamsaver also makes it easier to use this library, and simply just import it and also being able to use it where you can't install a service worker such as on jsfiddle.

tri2820 commented 1 year ago

Currently there's this issue in Brave blocking using the adapter for this also https://github.com/brave/brave-browser/issues/29411 https://github.com/jimmywarting/native-file-system-adapter/issues/59