{"id":16760374,"url":"https://github.com/roccomuso/batched-stream","last_synced_at":"2025-04-10T17:37:11.926Z","repository":{"id":57142456,"uuid":"141310540","full_name":"roccomuso/batched-stream","owner":"roccomuso","description":"Transform stream which batches a bunch of input data into groups of specified size (supporting objectMode).","archived":false,"fork":false,"pushed_at":"2018-08-31T17:49:24.000Z","size":9,"stargazers_count":9,"open_issues_count":1,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-24T00:44:07.101Z","etag":null,"topics":["batch","byte","chunks","nodejs","objectmode","stream","transform"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/roccomuso.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-17T15:41:58.000Z","updated_at":"2022-05-05T02:10:11.000Z","dependencies_parsed_at":"2022-09-05T11:50:21.079Z","dependency_job_id":null,"html_url":"https://github.com/roccomuso/batched-stream","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roccomuso%2Fbatched-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roccomuso%2Fbatched-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roccomuso%2Fbatched-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/roccomuso%2Fbatched-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/roccomuso","download_url":"https://codeload.github.com/roccomuso/batched-stream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248262041,"owners_count":21074236,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["batch","byte","chunks","nodejs","objectmode","stream","transform"],"created_at":"2024-10-13T04:23:19.593Z","updated_at":"2025-04-10T17:37:11.906Z","avatar_url":"https://github.com/roccomuso.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Batched Stream\n\n[![Build Status](https://travis-ci.org/roccomuso/batched-stream.svg?branch=master)](https://travis-ci.org/roccomuso/batched-stream)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n[![NPM Version](https://img.shields.io/npm/v/batched-stream.svg)](https://www.npmjs.com/package/batched-stream)\n![node](https://img.shields.io/node/v/batched-stream.svg)\n[![Dependency Status](https://david-dm.org/roccomuso/batched-stream.png)](https://david-dm.org/roccomuso/batched-stream)\n\n\n\u003e Transform stream supporting objectMode, which batches a bunch of input data into groups of specified size and will emit arrays, so that you can deal with pieces of input asynchronously.\n\n## Install\n\n\u003e npm install --save batched-stream\n\n## Usage\n\n```javascript\nconst BatchStream = require('batched-stream')\nconst batch = new BatchStream({\n  size : 5, // Bytes or N. of objects (when objectMode is true)\n  objectMode: true, // false by default\n  strictMode: false // return the rest of the batch when a stream contains a number of items that is not a strict multiply of the batch size\n})\n\nstream\n  .pipe(batch)\n  .pipe(new ArrayStream()) // In objectMode: true, deals with array input from pipe.\n```\n\nYou can `.pipe` other streams to it or `.write` them yourself (if you `.write` don't forget to `.end`). The options are passed down to the transform stream (you can increase the `highWaterMark` for example).\n\n- If `objectMode` is enabled the emitted batches are `Array` of length equal to `size`. Otherwise `Buffer` with byte `size`-length are emitted.\n\n- The `strictMode: false` allows to get the rest of the batch when a stream contains a number of items that is not a strict multiply of the batch size.\n\n## Test\n\n\u003e npm test\n\n\n### Author\n\nRocco Musolino ([@roccomuso](https://twitter.com/roccomuso))\n\n### License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froccomuso%2Fbatched-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froccomuso%2Fbatched-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froccomuso%2Fbatched-stream/lists"}