stream-to-blob
Convert a Readable Stream to a Blob
This package converts a Readable Stream into a Blob.
This package is used by WebTorrent.
install
npm install stream-to-blob
usage
var toBlob = require('stream-to-blob')
toBlob(fs.createReadStream('file.txt'), function (err, blob) {
if (err) return console.error(err.message)
console.log(blob)
})
api
toBlob(stream, [mimeType], callback)
Convert the Readable stream
into a W3C Blob
, optionally, with the given
mimeType
. The callback
will be called with two arguments:
- An
Error
object, or null
- A
Blob
object
license
MIT. Copyright (c) Feross Aboukhadijeh.