Socket
Book a DemoInstallSign in
Socket

chunk-store-multi-get

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chunk-store-multi-get

Get multiple chunks off a chunk-store

latest
Source
npmnpm
Version
1.2.0
Version published
Maintainers
1
Created
Source

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

FAQs

Package last updated on 12 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts