mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 14:59:16 +02:00
890 B
890 B
Home > bitburner > NS > getStdin
NS.getStdin() method
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.
Signature:
getStdin(): NetscriptPort | null;
Returns:
NetscriptPort | null