jimmywarting / StreamSaver.js

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

Cannot set mitm when working in typescript using a type definition #244

Closed jhnguyen521 closed 2 years ago

jhnguyen521 commented 3 years ago

import * as streamSaver from "streamsaver"; streamSaver.mitm = "url"

will give an error Cannot assign to 'mitm' because it is a read-only property.

jhnguyen521 commented 3 years ago

PR for potential fix https://github.com/jimmywarting/StreamSaver.js/pull/243

JounQin commented 2 years ago

I'm using Object.assign(streamSaver, {}) for workaround.

lukaw3d commented 2 years ago

This should work

- import * as streamSaver from "streamsaver";
+ import streamSaver from "streamsaver";
  streamSaver.mitm = "url"