Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    chunk-store-multi-getpublic

    chunk-store-multi-get

    Get multiple chunks off a chunk-store, in parallel.

    Example

    var get = require('chunk-store-multi-get');
    var mem = require('memory-chunk-store');
     
    var chunks = mem(10);
    chunks.put(0, Buffer('0123456789'), function(err){
      if (err) throw err;
      chunks.put(1, Buffer('0123456789'), function(err){
        if (err) throw err;
     
        get(chunks, {
          index: 0,
          length: 15,
          chunkLength: 10
        }, function(err, buf){
          if (err) throw err;
     
          console.log(buf.toString());
          // => 012345678901234
     
          chunks.close();
        });
      });
    });

    Installation

    $ npm install chunk-store-multi-get

    API

    get(store, opts, cb)

    Get chunks off store and call cb with the potential error and the result buffer.

    Options are:

    • chunkLength: the chunk length of the store (required)
    • index: the index to start at (required)
    • length: the total length to read (required)
    • offset

    License

    MIT

    Keywords

    none

    install

    npm i chunk-store-multi-get

    Downloadsweekly downloads

    5

    version

    1.2.0

    license

    MIT

    repository

    githubgithub

    last publish

    collaborators

    • avatar