chunkloader
v1.0.6
Published
Load file as chunks on browser.
Downloads
2
Maintainers
Readme
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