$ cnpm install from2-blob
Create a readable stream from a Blob with from2
.
npm install from2-blob
var fromBlob = require('from2-blob')
var toBlob = require('stream-to-blob')
var zlib = require('zlib')
fileInput.onchange = function () {
var stream = fromBlob(fileInput.files[0])
.pipe(zlib.createDeflate())
toBlob(stream, function (err, blob) {
if (err) throw err
window.open( URL.createObjectURL(blob) )
})
}
fromBlob(blob: Blob): Readable
Create a readable stream that will stream appropriately sized chunks of the given Blob.
Copyright 2014 - 2017 © taobao.org |