{"id":16760263,"url":"https://github.com/ryanve/edit-file","last_synced_at":"2025-03-16T09:16:33.014Z","repository":{"id":57219558,"uuid":"103786196","full_name":"ryanve/edit-file","owner":"ryanve","description":"Edit a file in Node.js","archived":false,"fork":false,"pushed_at":"2017-09-18T06:42:06.000Z","size":48,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-15T21:51:21.618Z","etag":null,"topics":["filesystem","node","nodejs"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/edit-file","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ryanve.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-09-16T21:53:44.000Z","updated_at":"2023-08-08T21:05:59.000Z","dependencies_parsed_at":"2022-08-28T23:22:31.699Z","dependency_job_id":null,"html_url":"https://github.com/ryanve/edit-file","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Fedit-file","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Fedit-file/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Fedit-file/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ryanve%2Fedit-file/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ryanve","download_url":"https://codeload.github.com/ryanve/edit-file/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243847056,"owners_count":20357317,"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":["filesystem","node","nodejs"],"created_at":"2024-10-13T04:22:55.655Z","updated_at":"2025-03-16T09:16:32.793Z","avatar_url":"https://github.com/ryanve.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [`edit-file`](https://www.npmjs.com/package/edit-file)\nEdit (read, edit, write) a file in Node.js\n\n```\nnpm install edit-file\n```\n\n## API\n\n### \u003ccode\u003eeditFile(file, edit=text=\u003etext, callback=\u003cvar\u003edone\u003c/var\u003e)\u003c/code\u003e\n\n- `file` is the filename path you want to edit. It may be relative or absolute.\n- `edit` is the editing function you use to change the text. The default returns the original text.\n- `callback` is a function to call after editing. The default throws errors and logs success.\n\n## Usage\n\n```js\nconst editFile = require(\"edit-file\")\n```\n\n```js\neditFile(\"example.txt\")\n```\n\n```js\neditFile(\"example.txt\", text =\u003e text.trim())\n```\n\n```js\neditFile(\"example.txt\", text =\u003e text.trim(), err =\u003e {\n  if (err) throw err\n  // ...\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanve%2Fedit-file","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryanve%2Fedit-file","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryanve%2Fedit-file/lists"}