{"id":19560652,"url":"https://github.com/zoubin/sink-transform","last_synced_at":"2025-09-05T10:32:55.656Z","repository":{"id":33544352,"uuid":"37190509","full_name":"zoubin/sink-transform","owner":"zoubin","description":"Wrapper for concat-stream to make a transform","archived":false,"fork":false,"pushed_at":"2016-04-18T07:49:42.000Z","size":15,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-25T23:33:34.725Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/zoubin.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.md","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":"2015-06-10T10:23:06.000Z","updated_at":"2018-10-18T17:41:35.000Z","dependencies_parsed_at":"2022-08-07T22:00:48.017Z","dependency_job_id":null,"html_url":"https://github.com/zoubin/sink-transform","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/zoubin/sink-transform","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Fsink-transform","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Fsink-transform/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Fsink-transform/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Fsink-transform/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zoubin","download_url":"https://codeload.github.com/zoubin/sink-transform/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zoubin%2Fsink-transform/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273746607,"owners_count":25160646,"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","status":"online","status_checked_at":"2025-09-05T02:00:09.113Z","response_time":402,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-11-11T05:08:23.418Z","updated_at":"2025-09-05T10:32:50.625Z","avatar_url":"https://github.com/zoubin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sink-transform\n[![version](https://img.shields.io/npm/v/sink-transform.svg)](https://www.npmjs.org/package/sink-transform)\n[![status](https://travis-ci.org/zoubin/sink-transform.svg)](https://travis-ci.org/zoubin/sink-transform)\n[![coverage](https://img.shields.io/coveralls/zoubin/sink-transform.svg)](https://coveralls.io/github/zoubin/sink-transform)\n[![dependencies](https://david-dm.org/zoubin/sink-transform.svg)](https://david-dm.org/zoubin/sink-transform)\n[![devDependencies](https://david-dm.org/zoubin/sink-transform/dev-status.svg)](https://david-dm.org/zoubin/sink-transform#info=devDependencies)\n\nA wrapper for [concat-stream] to make a transform to process the concated result.\n\n## Examples\n\n### Concat objects\nexample/reverse.js:\n\n```javascript\nvar sink = require('sink-transform')\nvar JSONStream = require('JSONStream')\n\nvar stream = sink.obj(function (rows, done) {\n  for (var i = rows.length - 1; i \u003e= 0; --i) {\n    this.push(rows[i])\n  }\n  done()\n})\n\nstream.pipe(JSONStream.stringify()).pipe(process.stdout)\n\nstream.write({ x:1 })\nstream.write({ y:2 })\nstream.write({ z:3 })\nstream.end()\n\n```\n\noutput:\n\n```\n⌘ node example/reverse.js\n[\n{\"z\":3}\n,\n{\"y\":2}\n,\n{\"x\":1}\n]\n```\n\n### Concat strings\n\nexample/concat.js:\n\n```javascript\nvar sink = require('sink-transform')\nvar fs = require('fs')\n\nfs.createReadStream(__dirname + '/files/a.js')\n  .pipe(sink.str(function (body, done) {\n    console.log(body)\n    done()\n  }))\n\n```\n\na.js:\n\n```javascript\nconsole.log('a')\n```\n\noutput:\n\n```\n⌘ node example/concat.js\nconsole.log('a')\n```\n\n## Usage\n\n```javascript\nvar sink = require('sink-transform')\nvar stream = sink(opts, trs)\n```\n\n### stream = sink(opts={}, transformFn)\n\n**opts**\n\nType: `Object`\n\nDirectly passsed to [concat-stream] as the first argument.\n\n**transformFn**\n\nType: `Function`\n\nSignature: `(concated, done) =\u003e {}`\n\nReceives the concated result of [concat-stream],\nand a callback to mark the end of the transform operation.\n\n### stream = sink.obj(transformFn)\nSame with `sink({ encoding: 'object' }, transformFn)`\n\n### stream = sink.str(transformFn)\nSame with `sink({ encoding: 'string' }, transformFn)`\n\n[concat-stream]: https://www.npmjs.com/package/concat-stream\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoubin%2Fsink-transform","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzoubin%2Fsink-transform","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzoubin%2Fsink-transform/lists"}