Socket
Book a DemoInstallSign in
Socket

chunkloader

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chunkloader

Load file as chunks on browser.

latest
Source
npmnpm
Version
1.0.6
Version published
Maintainers
1
Created
Source

chunkloader.js

Install: npm install chunkloader

Chunked file loader

// Create
var ChunkLoader = require('chunkloader')

var loader = new ChunkLoader({
  size:1024*1024
})
loader
.on('start',function(next) {
  console.log('start')
  next()
})
.on('error',function(err) {
  console.error(err)
})
.on('chunk',function(chunk,next) {
  // chunk
  // {
  //  data:Buffer object
  //  index:chunk index
  //  length:chunk length
  //  offset:chunk offset of the file
  // }
  something_to_do(function(err) {
    next(err)
  })
})
.on('complete',function() {
  console.log('complete')
})
// start loading
loader.load(evt.target.files[0])

Option

size

Specify chunk size default:1024*1024

License

MIT

Keywords

chunk

FAQs

Package last updated on 31 Dec 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