{"id":16644198,"url":"https://github.com/75lb/stream-via","last_synced_at":"2025-10-30T12:30:35.566Z","repository":{"id":34566626,"uuid":"38512573","full_name":"75lb/stream-via","owner":"75lb","description":"Process each chunk of a stream via the supplied function","archived":false,"fork":false,"pushed_at":"2017-06-17T23:17:24.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-02T08:31:51.394Z","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/75lb.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-07-03T22:16:07.000Z","updated_at":"2019-10-14T20:16:15.000Z","dependencies_parsed_at":"2022-08-30T16:43:30.425Z","dependency_job_id":null,"html_url":"https://github.com/75lb/stream-via","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Fstream-via","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Fstream-via/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Fstream-via/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/75lb%2Fstream-via/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/75lb","download_url":"https://codeload.github.com/75lb/stream-via/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238837890,"owners_count":19539080,"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-10-12T08:10:45.407Z","updated_at":"2025-10-30T12:30:30.542Z","avatar_url":"https://github.com/75lb.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![view on npm](http://img.shields.io/npm/v/stream-via.svg)](https://www.npmjs.org/package/stream-via)\n[![npm module downloads](http://img.shields.io/npm/dt/stream-via.svg)](https://www.npmjs.org/package/stream-via)\n[![Build Status](https://travis-ci.org/75lb/stream-via.svg?branch=master)](https://travis-ci.org/75lb/stream-via)\n[![Dependency Status](https://david-dm.org/75lb/stream-via.svg)](https://david-dm.org/75lb/stream-via)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)\n\n# stream-via\nProcess each chunk of a stream via the supplied function. Useful for meddling inside a stream pipeline. Works in both string/Buffer and object modes.\n\n## Synopsis\n\nReplace all instances of the `a` character with `4`.\n\n```js\nconst via = require('stream-via')\nconst fs = require('fs')\n\nprocess.stdin\n  .pipe(via(function (chunk) {\n    return chunk.toString().replace(/a/g, '4')\n  }))\n  .pipe(process.stdout)\n```\n\nOutput:\n```\n$ echo 'twat' | node example/simple.js\ntw4t\n```\n\n# API\n\n\u003ca name=\"module_stream-via\"\u003e\u003c/a\u003e\n\n## stream-via\n\n* [stream-via](#module_stream-via)\n    * [via(throughFunction, [options])](#exp_module_stream-via--via) ⇒ [\u003ccode\u003eDuplex\u003c/code\u003e](https://nodejs.org/api/stream.html#stream_class_stream_duplex) ⏏\n        * [.async(throughFunction, [options])](#module_stream-via--via.async) ⇒ [\u003ccode\u003eDuplex\u003c/code\u003e](https://nodejs.org/api/stream.html#stream_class_stream_duplex)\n        * [~throughFunction](#module_stream-via--via..throughFunction) : \u003ccode\u003efunction\u003c/code\u003e\n\n\u003ca name=\"exp_module_stream-via--via\"\u003e\u003c/a\u003e\n\n### via(throughFunction, [options]) ⇒ [\u003ccode\u003eDuplex\u003c/code\u003e](https://nodejs.org/api/stream.html#stream_class_stream_duplex) ⏏\n**Kind**: Exported function  \n**Params**\n\n- throughFunction [\u003ccode\u003ethroughFunction\u003c/code\u003e](#module_stream-via--via..throughFunction) - a function to process each chunk\n- [options] \u003ccode\u003eobject\u003c/code\u003e - passed to the returned stream constructor\n\n\u003ca name=\"module_stream-via--via.async\"\u003e\u003c/a\u003e\n\n#### via.async(throughFunction, [options]) ⇒ [\u003ccode\u003eDuplex\u003c/code\u003e](https://nodejs.org/api/stream.html#stream_class_stream_duplex)\n**Kind**: static method of [\u003ccode\u003evia\u003c/code\u003e](#exp_module_stream-via--via)  \n**Params**\n\n- throughFunction [\u003ccode\u003ethroughFunction\u003c/code\u003e](#module_stream-via--via..throughFunction) - a function to process each chunk\n- [options] \u003ccode\u003eobject\u003c/code\u003e - passed to the returned stream constructor\n\n\u003ca name=\"module_stream-via--via..throughFunction\"\u003e\u003c/a\u003e\n\n#### via~throughFunction : \u003ccode\u003efunction\u003c/code\u003e\n**Kind**: inner typedef of [\u003ccode\u003evia\u003c/code\u003e](#exp_module_stream-via--via)  \n**Params**\n\n- chunk \u003ccode\u003ebuffer\u003c/code\u003e | \u003ccode\u003estring\u003c/code\u003e\n- enc \u003ccode\u003estring\u003c/code\u003e\n- done \u003ccode\u003efunction\u003c/code\u003e - only used in `via.async`, call it like so: `done(err, returnValue)`.\n\n\n\n* * *\n\n\u0026copy; 2015-17 Lloyd Brookes \\\u003c75pound@gmail.com\\\u003e. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F75lb%2Fstream-via","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F75lb%2Fstream-via","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F75lb%2Fstream-via/lists"}