Nerdy Poly Millionaires

    chunkloader

    1.0.6 • Public • Published

    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

    Install

    npm i chunkloader

    DownloadsWeekly Downloads

    2

    Version

    1.0.6

    License

    MIT

    Last publish

    Collaborators

    • yusukeshibata