You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

hyperdrive-import-queue

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyperdrive-import-queue

A hyperdrive import queue that emits progress events.

2.1.0
latest
Source
npmnpm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

hyperdrive-import-queue

Takes an array of files, chunks and writes them to a hyperdrive archive. onFileWriteBegin callback returns each file object with a progress listener that emits file write progress info as each file is written. Progress info provided via progress-stream.

TODO: rabin-ify the chunks for non-browser hyperdrive imports.

Usage

arguments:

  • @files: array of files to import/write to archive
  • @archive: hyperdrive archive
  • @options: object -- see below
hyperdriveImportQueue(files, archive, {
  cwd: '',               // defaults to ''
  progressInterval: 100, // defaults to 100ms
  chunkSize: 4*1024,     // defaults to 4*1024
  onQueueNewFile: function (err, file) {
    // add file to your queue UI
  },
  onFileWriteBegin: function (err, file) {
    // you may now start incrementing your progress bar UI at this point
    // by attaching your progress listener callback to the `progress` event:
    file.progressListener.on('progress', function (progress) {
     // increment your progress bars here using the `progress` argument data
    })
  },
  onFileWriteComplete: function (err, file) {
    // a single file has now been written to the hyperdrive archive
    // the next file in the queue will start writing and trigger a new
    // `onFileWriteBegin` callback to fire
  },
  onCompleteAll: function (err, files) {
    // do whatever you like
  }
})

Keywords

dat

FAQs

Package last updated on 29 Sep 2016

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