Object built-in object

Object TTYInputStream

tty Read stream object, used to tty Read, write

There is no way you can create a separate class, globally only process.stdinexamples

1
process.stdin.read(1)

Inheritance

#lineWidth: 1.5 #font: Helvetica,sans-Serif #fontSize: 10 #leading: 1.6 #.this: fill=lightgray #.class: fill=white [<class>object|toString();toJSON()] [<class>Stream|fd|read();write();flush();close();copyTo()] [<this>TTYInputStream|isTTY;isRaw|setRawMode()] [object] <:- [Stream] [Stream] <:- [TTYInputStream] Stream fd read() write() flush() close() copyTo() TTYInputStream isTTY isRaw setRawMode() object toString() toJSON()

Member attributes

isTTY

Boolean, always true

1
readonly Boolean TTYInputStream.isTTY;

isRaw

Boolean, query whether it is in raw mode, when it is true, it means tty When configured to operate as raw device

1
readonly Boolean TTYInputStream.isRaw;

fd

Integer, query Stream The corresponding file descriptor value, implemented by the subclass

1
readonly Integer TTYInputStream.fd;

Member function

setRawMode

Set up tty Whether to work in raw mode

1
TTYInputStream TTYInputStream.setRawMode(Boolean isRawMode);

Call parameters:

  • isRawMode: Boolean, true, means working in raw mode; otherwise working in default mode. It readStream.isRawwill be set by this method

Return result:

  • TTYInputStream, Return to itself

read

Read data of the specified size from the stream

1
Buffer TTYInputStream.read(Integer bytes = -1) async;

Call parameters:

  • bytes: Integer, specify the amount of data to be read, the default is to read a random size data block, the size of the data read depends on the device

Return result:

  • Buffer, Return the data read from the stream, if there is no data to read, or the connection is interrupted, then return null

write

Write the given data to the stream

1
TTYInputStream.write(Buffer data) async;

Call parameters:

  • data: Buffer, Given the data to be written

flush

Write the contents of the file buffer to the physical device

1
TTYInputStream.flush() async;

close

Close the current stream object

1
TTYInputStream.close() async;

copyTo

Copy the stream data to the target stream

1 2
Long TTYInputStream.copyTo(Stream stm, Long bytes = -1) async;

Call parameters:

  • stm: Stream, The target stream object
  • bytes: Long, the number of bytes copied

Return result:

  • Long, Returns the number of bytes copied

toString

Returns the string representation of the object, generally returns "[Native Object]", the object can be re-implemented according to its own characteristics

1
String TTYInputStream.toString();

Return result:

  • String, Returns the string representation of the object

toJSON

Returns the JSON format representation of the object, generally returns a collection of readable attributes defined by the object

1
Value TTYInputStream.toJSON(String key = "");

Call parameters:

  • key: String, unused

Return result:

  • Value, Returns a value containing JSON serializable