{"id":13527712,"url":"https://github.com/stream-utils/stream-to-array","last_synced_at":"2026-01-11T08:56:26.251Z","repository":{"id":10568126,"uuid":"12772942","full_name":"stream-utils/stream-to-array","owner":"stream-utils","description":"[OBSOLUTE] Concatenate a readable stream's data into a single array.","archived":true,"fork":false,"pushed_at":"2024-08-31T20:31:18.000Z","size":31,"stargazers_count":100,"open_issues_count":2,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T11:46:14.816Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stream-utils.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-09-12T02:19:35.000Z","updated_at":"2024-08-31T20:33:19.000Z","dependencies_parsed_at":"2024-10-29T16:38:11.639Z","dependency_job_id":null,"html_url":"https://github.com/stream-utils/stream-to-array","commit_stats":{"total_commits":51,"total_committers":8,"mean_commits":6.375,"dds":0.196078431372549,"last_synced_commit":"18ee20b27ca3dd29ed48e6c0cddf8252fca29e75"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stream-utils%2Fstream-to-array","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stream-utils%2Fstream-to-array/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stream-utils%2Fstream-to-array/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stream-utils%2Fstream-to-array/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stream-utils","download_url":"https://codeload.github.com/stream-utils/stream-to-array/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241494048,"owners_count":19971869,"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":[],"created_at":"2024-08-01T06:01:58.164Z","updated_at":"2026-01-11T08:56:26.238Z","avatar_url":"https://github.com/stream-utils.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# Stream to Array\n\n\u003e **OBSOLETE: since node@18, there is now a [stream.toArray()](https://github.com/stream-utils/stream-to-array/issues/26) function**\n\n[![NPM version][npm-image]][npm-url]\n[![Build status][travis-image]][travis-url]\n[![Test coverage][coveralls-image]][coveralls-url]\n[![Dependency Status][david-image]][david-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\nConcatenate a readable stream's data into a single array.\n\nYou may also be interested in:\n\n- [raw-body](https://github.com/stream-utils/raw-body) for strings\n\n## API\n\n```js\nvar toArray = require('stream-to-array')\n```\n\n### toArray([stream], [callback(err, arr)])\n\nReturns all the data objects in an array.\nThis is useful for streams in object mode if you want to just use an array.\n\n```js\nvar stream = new Stream.Readable()\ntoArray(stream, function (err, arr) {\n  assert.ok(Array.isArray(arr))\n})\n```\n\nIf `stream` is not defined, it is assumed that `this` is a stream.\n\n```js\nvar stream = new Stream.Readable()\nstream.toArray = toArray\nstream.toArray(function (err, arr) {\n\n})\n```\n\nIf `callback` is not defined, then it returns a promise.\n\n```js\ntoArray(stream)\n  .then(function (parts) {\n\n  })\n```\n\nIf you want to return a buffer, just use `Buffer.concat(arr)`\n\n```js\ntoArray(stream)\n  .then(function (parts) {\n    const buffers = parts\n      .map(part =\u003e util.isBuffer(part) ? part : Buffer.from(part));\n    return Buffer.concat(buffers);\n  })\n```\n\n[npm-image]: https://img.shields.io/npm/v/stream-to-array.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/stream-to-array\n[github-tag]: http://img.shields.io/github/tag/stream-utils/stream-to-array.svg?style=flat-square\n[github-url]: https://github.com/stream-utils/stream-to-array/tags\n[travis-image]: https://img.shields.io/travis/stream-utils/stream-to-array.svg?style=flat-square\n[travis-url]: https://travis-ci.org/stream-utils/stream-to-array\n[coveralls-image]: https://img.shields.io/coveralls/stream-utils/stream-to-array.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/r/stream-utils/stream-to-array?branch=master\n[david-image]: http://img.shields.io/david/stream-utils/stream-to-array.svg?style=flat-square\n[david-url]: https://david-dm.org/stream-utils/stream-to-array\n[license-image]: http://img.shields.io/npm/l/stream-to-array.svg?style=flat-square\n[license-url]: LICENSE\n[downloads-image]: http://img.shields.io/npm/dm/stream-to-array.svg?style=flat-square\n[downloads-url]: https://npmjs.org/package/stream-to-array\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstream-utils%2Fstream-to-array","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstream-utils%2Fstream-to-array","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstream-utils%2Fstream-to-array/lists"}