Stuk / jszip

Create, read and edit .zip files with Javascript
https://stuk.github.io/jszip/
Other
9.81k stars 1.3k forks source link

Fix loading Blob in Node environment #903

Open UlyssesZh opened 1 year ago

UlyssesZh commented 1 year ago

I fixed #899. The major problem is due to lack of FileReader in Node.

I also cleaned the logic of converting a blob into an array buffer. Note the fact: FileReader.prototype.readAsArrayBuffer and Blob.prototype.arrayBuffer essentially does the same thing, but the former uses callback while the latter uses promise. Also, because File inherits Blob, we do not need to specially take care of File.

npm run test seems fine. Tests all pass.