jimmywarting / StreamSaver.js

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

some doubts about the configuration part of readme.md #147

Closed ghost closed 4 years ago

ghost commented 4 years ago

Is it here to configure compatibility?The code should be:?

streamSaver.WritableStream = WebStreamsPolyfill.WritableStream;
streamSaver.TransformStream = WebStreamsPolyfill.TransformStream
jimmywarting commented 4 years ago

if you load web streams polyfill in any other way but the cdn then yes.

if you include this

<script src="https://cdn.jsdelivr.net/npm/web-streams-polyfill@2.0.2/dist/ponyfill.min.js"></script>

and the window.WebStreamsPolyfill becomes available streamsaver can detect it and use it automatically

https://github.com/jimmywarting/StreamSaver.js/blob/a6ec1df37593c29a4b172ebc85d4038aae812c9c/StreamSaver.js#L15


if you don't then streamsaver will use the global writable/transform stream (that's only avalible in Blink)

ghost commented 4 years ago

@jimmywarting Thank you for your answer!In my free time I will read and learn the source code.