random-access-blob

0.1.2 • Public • Published

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

Package Sidebar

Install

npm i random-access-blob

Weekly Downloads

2

Version

0.1.2

License

MIT

Unpacked Size

10.5 kB

Total Files

7

Last publish

Collaborators

  • werle