{"library":"stdin","title":"Node.js Standard Input Helper","type":"library","description":"This package provides a minimal, callback-based utility for reading standard input in Node.js environments. Published in 2012 and last updated around that time (version 0.0.1), it addresses the common pain point of handling `stdin` streams in Node.js, which was less streamlined in older versions. It offers a single function that consumes the entire standard input as a string and provides it to a callback. Given its age and the significant evolution of Node.js with better-supported stream APIs (like `process.stdin` directly, `readline` module, or `async` iterators), this package is largely obsolete. Its release cadence was minimal, likely a one-off utility. At the time of its release, its key differentiator was its simplicity over raw stream handling. However, it lacks modern features like Promises, async/await, or TypeScript support.","language":"javascript","status":"abandoned","last_verified":"Sun Apr 19","install":{"commands":["npm install stdin"],"cli":null},"imports":["const stdin = require('stdin');"],"auth":{"required":false,"env_vars":[]},"links":{"homepage":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/stdin","openapi_spec":null,"status_page":null,"smithery":null},"quickstart":{"code":"const stdin = require('stdin');\n\nconsole.log(\"Please type something and press Enter, then signal EOF (Ctrl+D on Unix/macOS, Ctrl+Z then Enter on Windows):\");\n\nstdin(function(inputString) {\n  if (inputString && inputString.trim().length > 0) {\n    console.log(\"You entered:\", inputString.trim());\n  } else {\n    console.log(\"No input received from stdin.\");\n  }\n  process.exit(0);\n});\n\n// Add a timeout in case no input is provided, to prevent the process from hanging indefinitely\n// In a real application, you might use an explicit `process.stdin.on('end')` or `process.exit()`\n// based on application logic, but for a quickstart, a timeout can prevent indefinite waits.\n// For interactive use, user must signal EOF (Ctrl+D / Ctrl+Z).\nsetTimeout(() => {\n  if (!process.stdin.isTTY) {\n    // If stdin is not a TTY (e.g., piped input), the `stdin` package should handle `end` automatically.\n    // This timeout is primarily for interactive sessions where EOF might not be sent.\n  }\n}, 5000).unref(); // unref allows the program to exit if other work is done","lang":"javascript","description":"Demonstrates how to use the `stdin` package to read a complete string from standard input and process it using a callback function. Users must manually signal end-of-file (EOF).","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}