New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

iterator-chunker

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iterator-chunker

Breaks down iterators in to chunks

latest
Source
npmnpm
Version
2.0.1
Version published
Maintainers
1
Created
Source

iterator-chunker

An Readable stream object that breaks down iterables into array chunks and streams the chunks.

Extends require('stream').Readable.

Eg:

var Chunker = require('iterator-chunker')

var chunks = []
var iterable = [1,2,3,4,5,6,7,8,9,10]
var chunker = new Chunker(iterable, 3)  //chunk size = 3

chunker.on('data', function(chunk){
  chunks.push(chunk)
})

chunker.on('end', function(){
  console.log(chunks)
})


//logs:
// [[1,2,3],[4,5,6],[7,8,9],[10]]

Constructor

Chunker(iterable, chunkSize)

  • takes an iterable and an integer chunkSize. The iterable will be broken into arrays of length chunksize. Of course the last chunk may be smaller than chunkSize. The chunks are streamed to the 'data' handler.

Keywords

iterator

FAQs

Package last updated on 03 May 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