JSPM

idb-content-addressable-blob-store

1.1.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 1
    • Score
      100M100P100Q36681F
    • License Mit

    content-addressable IndexedDB blob store

    Package Exports

    • idb-content-addressable-blob-store

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (idb-content-addressable-blob-store) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    idb-content-addressable-blob-store

    content-addressable IndexedDB blob store

    blob-store-compatible

    example

    var store = require('idb-content-addressable-blob-store');
    var blob = store();
    var stdout = require('console-stream')();
    
    var w = blob.createWriteStream(function (err, meta) {
        console.log('# hash=', meta.key);
        blob.createReadStream(meta.key).pipe(stdout);
    });
    w.end('abcdefg');

    methods

    var store = require('idb-content-addressable-blob-store')

    var blob = store()

    Create a new blob store.

    blob.createWriteStream(opts, cb)

    Create a new blob with chunks of size opts.size, default: 16384.

    The key will be generated from the sha256 of the content and is available from meta.key in cb(err, meta).

    blob.createReadStream(opts)

    Create a read stream for the chunks at opts.key.

    blob.exists(opts, cb)

    Check if opts.key exists with cb(err, exists).

    blob.remove(opts, cb)

    Remove the key at opts.key.

    install

    With npm do:

    npm install idb-content-addressable-blob-store

    license

    MIT