{"id":20178136,"url":"https://github.com/vsnthdev/read-file-input","last_synced_at":"2026-04-18T13:32:23.873Z","repository":{"id":57348531,"uuid":"434708979","full_name":"vsnthdev/read-file-input","owner":"vsnthdev","description":"Opens a 📝 text editor, waits until closed \u0026 captures 🔬 file content.","archived":false,"fork":false,"pushed_at":"2024-03-03T14:25:15.000Z","size":187,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-10T23:52:16.703Z","etag":null,"topics":["cli","command-line","editor","input","prompt","prompts","readline","stdin","terminal"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/vsnthdev.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-03T19:20:58.000Z","updated_at":"2022-01-07T19:09:28.000Z","dependencies_parsed_at":"2024-03-03T15:40:55.012Z","dependency_job_id":null,"html_url":"https://github.com/vsnthdev/read-file-input","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vsnthdev/read-file-input","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsnthdev%2Fread-file-input","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsnthdev%2Fread-file-input/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsnthdev%2Fread-file-input/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsnthdev%2Fread-file-input/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vsnthdev","download_url":"https://codeload.github.com/vsnthdev/read-file-input/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vsnthdev%2Fread-file-input/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31971486,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"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":["cli","command-line","editor","input","prompt","prompts","readline","stdin","terminal"],"created_at":"2024-11-14T02:19:28.926Z","updated_at":"2026-04-18T13:32:23.856Z","avatar_url":"https://github.com/vsnthdev.png","language":"TypeScript","readme":"\u003ch1 align=\"center\"\u003e\n    \u003ccode\u003eread-file-input\u003c/code\u003e\n\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\u003cstrong\u003eOpens a 📝 text editor, waits until closed \u0026 captures 🔬 file content.\u003c/strong\u003e\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca target=\"_blank\" rel=\"noopener\" href=\"https://www.npmjs.com/package/read-file-input\"\u003e\n        \u003cimg src=\"https://img.shields.io/npm/v/read-file-input.svg?style=flat-square\" alt=\"\"\u003e\n    \u003c/a\u003e\n    \u003ca target=\"_blank\" rel=\"noopener\" href=\"https://www.npmjs.com/package/read-file-input?activeTab=versions\"\u003e\n        \u003cimg src=\"https://img.shields.io/npm/dm/read-file-input.svg?style=flat-square\" alt=\"\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/vsnthdev/read-file-input/issues\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/issues/vsnthdev/read-file-input.svg?style=flat-square\" alt=\"\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/vsnthdev/read-file-input/commits/main\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/last-commit/vsnthdev/read-file-input.svg?style=flat-square\"\n            alt=\"\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\u003cbr\u003e\n\nAllows you to capture user input by opening a text editor instead of `stdin`. Manually passing large amounts of data through `stdin` is cumbersome and not widely supported as it depends on the terminal emulator.\n\nThis module creates a temporary file and opens it with the configured text editor. When the user saves the file and quits the editor, we read back the file while optionally deleting it.\n\nSince most text editors support UTF-8, any emojis and special characters will be handled safely instead of replying on the terminal.\n\n\u003e Tweet \u003ca target=\"_blank\" rel=\"noopener\" href=\"https://vas.cx/twitter\"\u003e@vsnthdev\u003c/a\u003e, I would love to know your opinion \u0026 experience on this project 😍\n\n## ✨ Features\n\n1. Cross platform\n2. Supports graphical \u0026 terminal editors\n3. Prefills the file with content\n\n## 💿 Installation\n\n\u003ca href=\"https://www.npmjs.com/package/read-file-input\"\u003e\u003cimg src=\"https://nodei.co/npm/read-file-input.png?downloads=true\u0026downloadRank=true\u0026stars=true\" alt=\"npm module badge\"\u003e\u003c/a\u003e\n```\nnpm i read-file-input\n```\n\n## 🚀 Quick Start\n\nAfter `read-file-input` as a dependency using the above command, you can use it in the following way:\n\n```javascript\n// import readFileInput from 'read-file-input'\nimport readFi from '../dist/read-file-input.js'\n\n// read from the user with zero configuration\nconst read = await readFi()\n\n// print the input we have read\nconsole.log('Read input as:')\nconsole.log(read)\n\n```\n\n## 🧪 Configuration\n\n```typescript\nexport interface ConfigImpl {\n    // the name of the file created, defaults to \"[id].txt\"\n    // where [id] is replaced with a random 5 character string\n    // to prevent conflicts\n    name?: string\n\n    // a custom editor command which defaults to notepad.exe on Windows\n    // and uses the $VISUAL \u0026 $EDITOR environment variables on Linux \u0026 macOS\n    editor?: string\n\n    // whether to delete the file after the input has been read\n    // defaults to true and recommended to keep it that way\n    cleanup?: boolean\n\n    // do not wait for the editor to be closed, just return\n    // as soon as the editor has opened, useful to just show\n    // some content rather than taking inputs\n    noWait?: boolean\n\n    // the content that the temporary file should be pre-filled with\n    // undefined by default\n    content?: {\n        // the string of data which will be pre-filled onto the\n        // temporary file, will override the file setting\n        data?: string\n\n        // path to a file from which the content will be read\n        // for generating the temporary file\n        // useful for passing large amount of data for the temporary file\n        file?: string\n    }\n}\n\n```\n\n## 💻 Building \u0026 Dev Setup\n\nYou need to be at least on **Node.js v17 or above** and follow the below instructions to build the project 👇\n\n- **STEP 1️⃣**  Clone this project\n- **STEP 2️⃣**  Run **`npm install`** to get all dependencies\n- **STEP 3️⃣**  To build the TypeScript project run **`npm run build`**\n\nNow you should have a `dist` folder in the project directory.\n\n### ⚡ Running Examples\n\nOnce you have successfully built the project, to run a basic example 👇\n\n```\nnode examples/basic.js\n```\n\nCheckout [other examples](https://github.com/vsnthdev/read-file-input/tree/main/examples) to know more on different use cases and configuration of options of **read-file-input**.\n\n### 🛠️ Writing Code\n\nThis project follows [Vasanth's Commit Style](https://vas.cx/commits) for commit messages.\n\n\u003c!-- footer --\u003e\n\n## 📰 License\n\u003e The **read-file-input** project is released under the [MIT license](https://github.com/vsnthdev/read-file-input/blob/main/LICENSE.md). \u003cbr\u003e Developed \u0026amp; maintained By Vasanth Srivatsa. Copyright 2023 © Vasanth Developer.\n\u003chr\u003e\n\n\u003e \u003ca href=\"https://vsnth.dev\" target=\"_blank\" rel=\"noopener\"\u003evsnth.dev\u003c/a\u003e \u0026nbsp;\u0026middot;\u0026nbsp;\n\u003e YouTube \u003ca href=\"https://vas.cx/videos\" target=\"_blank\" rel=\"noopener\"\u003e@vasanthdeveloper\u003c/a\u003e \u0026nbsp;\u0026middot;\u0026nbsp;\n\u003e Twitter \u003ca href=\"https://vas.cx/twitter\" target=\"_blank\" rel=\"noopener\"\u003e@vsnthdev\u003c/a\u003e \u0026nbsp;\u0026middot;\u0026nbsp;\n\u003e Discord \u003ca href=\"https://vas.cx/discord\" target=\"_blank\" rel=\"noopener\"\u003eVasanth Developer\u003c/a\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvsnthdev%2Fread-file-input","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvsnthdev%2Fread-file-input","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvsnthdev%2Fread-file-input/lists"}