1.1.1 • Published 5 years ago

browser-cache-blob-store v1.1.1

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

browser-cache-blob-store

build status

npm

blob-store-compatible

blob store that stores blobs using the browser Cache interface. This interface is part of the Service Worker spec but is available to windowed scopes as well as workers.

npm install browser-cache-blob-store

Usage

var cacheStore = require('browser-cache-blob-store')
var collect = require('collect-stream')
var blobs = cacheStore()

var ws = blobs.createWriteStream({
  key: 'some/path/file.txt'
}, function (err, opts) {
  collect(blobs.createReadStream(opts.key), function (err, readBuf) {
    console.log(readBuf.toString())
  })
})

ws.write('hello world\n')
ws.end()

Known Issues

The blob will not be immediately available after the writable stream emits the finish event. To be sure it is ready, use the callback.

License

MIT