0.1.2 • Published 5 years ago
random-access-blob v0.1.2
random-access-blob
A random access storage interface for Blob instances (like File).
Installation
$ npm install random-access-blobUsage
const rab = require('random-access-blob')
const blob = new Blob([ someTypedArray ])
const storage = rab(blob)
storage.read(0, 4, (err, buf) => {
// handle 4 byte buffer
})API
storage = require('random-access-blob')(blob[, options])
Create a RandomAccessBlob instance from a blob that is "readable"
and "statable". options can be:
{
offset: 0, // An optional offset to start reading from in the Blob
}storage = require('random-access-blob/file')(file[, options])
Create a RandomAccessBlobFile instance from a file that is
"readable" and "statable".
{
offset: 0, // An optional offset to start reading from in the File
}storage.read(offset, length, callback)
Read a buffer from the storage.
storage.stat(callback)
Stat the storage to get the blob size.
License
MIT