random-access-blob
v0.1.2
Published
A random access storage interface for Blob instances (like File).
Downloads
4
Maintainers
Readme
random-access-blob
A random access storage interface for Blob instances (like File).
Installation
$ npm install random-access-blob
Usage
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