objectTTYInputStream
ttyread stream object forttyread, write
There is no way to create this class alone, there are only process.stdin
instances
1process.stdin.read(1)
inheritance relationship
member attribute
isTTY
Boolean, always true
1readonly Boolean TTYInputStream.isTTY;
isRaw
Boolean, the query is in raw mode, when it is true, it meansttyWhen configured to operate as a raw device
1readonly Boolean TTYInputStream.isRaw;
fd
Integer, queryStreamThe corresponding file descriptor value, implemented by subclasses
1readonly Integer TTYInputStream.fd;
member function
setRawMode
set upttyWhether to work in raw mode
1TTYInputStream TTYInputStream.setRawMode(Boolean isRawMode);
Call parameters:
- isRawMode: Boolean, if it is true, it means to work in raw mode; otherwise, it will work in default mode.
readStream.isRaw
It will be set by this method
return result:
- TTYInputStream, returns itself
read
Read data of the specified size from the stream
1Buffer TTYInputStream.read(Integer bytes = -1) async;
Call parameters:
- bytes: Integer, specify the amount of data to read, the default is to read data blocks of random size, the size of the read data depends on the device
return result:
- Buffer, returns the data read from the stream, or null if there is no data to read or the connection is interrupted
write
writes the given data to the stream
1TTYInputStream.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
1TTYInputStream.flush() async;
close
close the current stream object
1TTYInputStream.close() async;
copyTo
Copy stream data to target stream
1
2Long 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
Return the string representation of the object, generally return "[Native Object]", the object can be reimplemented according to its own characteristics
1String TTYInputStream.toString();
return result:
- String, returns a string representation of the object
toJSON
Returns the JSON format representation of the object, generally returns a collection of readable properties defined by the object
1Value TTYInputStream.toJSON(String key = "");
Call parameters:
- key: String, not used
return result:
- Value, which returns a JSON-serializable value