PIPE: Add pipe support for passing data into and out of terminal commands (#2395)

This commit is contained in:
Michael Ficocelli
2026-02-22 12:18:23 -07:00
committed by GitHub
parent 4a22e16058
commit 92b8b58588
68 changed files with 2430 additions and 480 deletions

View File

@@ -8991,6 +8991,21 @@ export interface NS {
*/
dynamicImport(path: string): Promise<any>;
/**
* Retrieves the NetscriptPort handle used to get input piped to the script.
* Examples:
*
* If a script was run with data piped into it via the terminal:
* `echo input1 | run myScript.js`
*
* then `ns.getStdin().read()` inside `myScript.js` would return `"input1"`.
*
* If more data is added later (for example, if one script's terminal is piped to another script),
* then the script can read that data from `ns.getStdin()` as well.
* `await ns.getStdin().nextPortWrite()` can be used to wait until new data is available to read.
*/
getStdin(): NetscriptPort | null;
enums: NSEnums;
}