{"id":17242602,"url":"https://github.com/robinweser/read-transform-write","last_synced_at":"2025-08-13T02:48:07.253Z","repository":{"id":57348606,"uuid":"124651651","full_name":"robinweser/read-transform-write","owner":"robinweser","description":"Transform files with ease","archived":false,"fork":false,"pushed_at":"2018-12-30T13:36:09.000Z","size":60,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-08T07:41:40.152Z","etag":null,"topics":["fs","readfile","transforming-files","utility","writefile"],"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/robinweser.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":"2018-03-10T12:00:32.000Z","updated_at":"2024-04-16T10:52:24.000Z","dependencies_parsed_at":"2022-08-25T05:20:43.543Z","dependency_job_id":null,"html_url":"https://github.com/robinweser/read-transform-write","commit_stats":null,"previous_names":["rofrischmann/read-transform-write"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/robinweser/read-transform-write","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinweser%2Fread-transform-write","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinweser%2Fread-transform-write/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinweser%2Fread-transform-write/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinweser%2Fread-transform-write/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robinweser","download_url":"https://codeload.github.com/robinweser/read-transform-write/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robinweser%2Fread-transform-write/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270170549,"owners_count":24539360,"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-08-13T02:00:09.904Z","response_time":66,"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":["fs","readfile","transforming-files","utility","writefile"],"created_at":"2024-10-15T06:13:38.909Z","updated_at":"2025-08-13T02:48:07.190Z","avatar_url":"https://github.com/robinweser.png","language":"JavaScript","funding_links":["https://www.patreon.com/rofrischmann"],"categories":[],"sub_categories":[],"readme":"# read-transform-write\n\nAn easy-to-use utility to transform files with a single function.\u003cbr\u003e\nIt uses `fs.readFile` and `fs.writeFile` under the hood and throws an error if something goes wrong.\u003cbr\u003e\nThe `encoding` is set to `utf8`. If you need something else, please file an issue.\n\n\u003cimg alt=\"TravisCI\" src=\"https://travis-ci.org/rofrischmann/read-transform-write.svg?branch=master\"\u003e \u003ca href=\"https://codeclimate.com/github/rofrischmann/read-transform-write/coverage\"\u003e\u003cimg alt=\"Test Coverage\" src=\"https://codeclimate.com/github/rofrischmann/read-transform-write/badges/coverage.svg\"\u003e\u003c/a\u003e \u003cimg alt=\"npm version\" src=\"https://badge.fury.io/js/read-transform-write.svg\"\u003e \u003cimg alt=\"npm downloads\" src=\"https://img.shields.io/npm/dm/read-transform-write.svg\"\u003e \u003cimg alt=\"dependencies\" src=\"https://david-dm.org/rofrischmann/read-transform-write.svg\"\u003e\n\n## Support Me\nIf you're using [Robin Frischmann](https://rofrischmann.de)'s work, please consider supporting his [Open Source Projects](https://github.com/rofrischmann) on [**Patreon**](https://www.patreon.com/rofrischmann).\n\n## Installation\n```sh\n# yarn\nyarn add read-transform-write\n\n# npm\nnpm i --save read-transform-write\n```\n\n## Usage\n\n### Parameter\n\n| Parameter | Type | Description |\n| --- | --- | --- |\n| inputPath | (*string*) | The absolute path to the input file. |\n| transform | (*Function*) | The transformation method.\u003cbr\u003eIt receives the input data and returns method receving a write-method that must be called with the transformed data and a output path. |\n| callback | (*Function?*) | An optional callback that receives an object with the callback shape. |\n\n#### Callback Shape\n```javascript\ntype Callback {\n  inputPath: string,\n  outputPath: string,\n  input: string,\n  output: string\n}\n```\n\n### Example\n```javascript\nimport { join } from 'path'\nimport transformFile from 'read-transform-write'\n\nconst input = join(__dirname, 'input.txt')\nconst output = join(__dirname, 'output.txt')\n\nconst transform = data =\u003e write =\u003e write(\n  output,\n  data\n    .split('\\n')\n    .map(val =\u003e parseInt(val, 10))\n    .map(Math.sqrt)\n    .join('\\n')\n)\n\ntransformFile(\n  input,\n  transform,\n  ({ output, outputPath }) =\u003e {\n    console.log(`Written ${output} to ${outputPath}.`)\n  }\n)\n```\n\n##### input.txt\n```\n49\n36\n25\n16\n```\n\n##### output.txt\n```\n7\n6\n5\n4\n```\n\n\n## License\nread-transform-write is licensed under the [MIT License](http://opensource.org/licenses/MIT).\u003cbr\u003e\nDocumentation is licensed under [Creative Common License](http://creativecommons.org/licenses/by/4.0/).\u003cbr\u003e\nCreated with ♥ by [@rofrischmann](http://rofrischmann.de).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobinweser%2Fread-transform-write","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobinweser%2Fread-transform-write","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobinweser%2Fread-transform-write/lists"}