{"id":17399237,"url":"https://github.com/feross/stream-with-known-length-to-buffer","last_synced_at":"2025-07-20T06:32:42.641Z","repository":{"id":57372108,"uuid":"48765635","full_name":"feross/stream-with-known-length-to-buffer","owner":"feross","description":"Convert a Readable Stream with a known length into a Buffer","archived":false,"fork":false,"pushed_at":"2020-07-17T04:34:15.000Z","size":29,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-04T02:51:39.688Z","etag":null,"topics":["buffer","javascript","nodejs","readable","stream","streams"],"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/feross.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}},"created_at":"2015-12-29T20:22:11.000Z","updated_at":"2023-09-29T11:07:22.000Z","dependencies_parsed_at":"2022-09-07T18:10:32.661Z","dependency_job_id":null,"html_url":"https://github.com/feross/stream-with-known-length-to-buffer","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/feross/stream-with-known-length-to-buffer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feross%2Fstream-with-known-length-to-buffer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feross%2Fstream-with-known-length-to-buffer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feross%2Fstream-with-known-length-to-buffer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feross%2Fstream-with-known-length-to-buffer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/feross","download_url":"https://codeload.github.com/feross/stream-with-known-length-to-buffer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/feross%2Fstream-with-known-length-to-buffer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266076350,"owners_count":23872741,"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":["buffer","javascript","nodejs","readable","stream","streams"],"created_at":"2024-10-16T15:13:47.056Z","updated_at":"2025-07-20T06:32:42.618Z","avatar_url":"https://github.com/feross.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stream-with-known-length-to-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]\n\n[travis-image]: https://img.shields.io/travis/feross/stream-with-known-length-to-buffer/master.svg\n[travis-url]: https://travis-ci.org/feross/stream-with-known-length-to-buffer\n[npm-image]: https://img.shields.io/npm/v/stream-with-known-length-to-buffer.svg\n[npm-url]: https://npmjs.org/package/stream-with-known-length-to-buffer\n[downloads-image]: https://img.shields.io/npm/dm/stream-with-known-length-to-buffer.svg\n[downloads-url]: https://npmjs.org/package/stream-with-known-length-to-buffer\n[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg\n[standard-url]: https://standardjs.com\n\n#### Convert a Readable Stream with a known length into a Buffer\n\n[![Sauce Test Status](https://saucelabs.com/browser-matrix/stream-with.svg)](https://saucelabs.com/u/stream-with)\n\nThis package converts a Readable Stream into a Buffer, with just one Buffer\nallocation (excluding allocations done internally by the streams implementation).\n\nThis is lighter-weight choice than\n[`stream-to-array`](https://github.com/stream-utils/stream-to-array) when the\ntotal stream length is known in advance. This whole package is 15 lines.\n\nThis module is used by [WebTorrent](https://webtorrent.io).\n\n### install\n\n```\nnpm install stream-with-known-length-to-buffer\n```\n\n### usage\n\n```js\nvar toBuffer = require('stream-with-known-length-to-buffer')\n\ntoBuffer(fs.createReadStream('file.txt'), 1000, function (err, buf) {\n  if (err) return console.error(err.message)\n  console.log(buf)\n})\n```\n\n### license\n\nMIT. Copyright (c) [Feross Aboukhadijeh](http://feross.org).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeross%2Fstream-with-known-length-to-buffer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffeross%2Fstream-with-known-length-to-buffer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffeross%2Fstream-with-known-length-to-buffer/lists"}