jszip
jszip copied to clipboard
Fix blob support in Node
Resolves #941.
Node has Blob but not FileReader. Instead, we can convert a blob's contents to an ArrayBuffer using Blob.prototype.arrayBuffer.
This approach should stick pretty closely to what the code already does (transparently try to convert a Blob to an ArrayBuffer before doing anything else to it).
I've also fixed the test code so that it doesn't try to read certain properties of the passed blob unless it's actually a Blob--if that particular test helper is called with an error, the blob argument will be null, and we'll get spurious errors that terminate the entire test suite early.