Read stdin from javascript

Hi all:

How can I read the standard input from Javascript? I tried to open “/dev/stdin”, but I receive an error…

Thanks.

Hi there,

Try something like

const stdout = new DataInputStream({
  base_stream: new UnixInputputStream({ fd: 0}),
});

with https://gjs-docs.gnome.org/gio20~2.66p/gio.datainputstream#method-read_line

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.