Ende.stdout
variable
const Ende.stdout: { … }A reference to stdout which can be used to write directly to stdout.
It implements the Ende specific
Writer,
WriterSync,
and Closer interfaces as well as provides a
WritableStream interface.
These are low level constructs, and the console interface is a
more straight forward way to interact with stdout and stderr.
Properties
writable
readonly writable: WritableStream<Uint8Array<ArrayBufferLike>>A writable stream interface to stdout.
Methods
write
write(p: Uint8Array): Promise<number>Write the contents of the array buffer (p) to stdout.
Resolves to the number of bytes written.
It is not guaranteed that the full buffer will be written in a single call.
const encoder = new TextEncoder();
const data = encoder.encode("Hello world");
const bytesWritten = await Ende.stdout.write(data); // 11
writeSync
writeSync(p: Uint8Array): numberSynchronously write the contents of the array buffer (p) to stdout.
Returns the number of bytes written.
It is not guaranteed that the full buffer will be written in a single call.
const encoder = new TextEncoder();
const data = encoder.encode("Hello world");
const bytesWritten = Ende.stdout.writeSync(data); // 11
close
close(): voidCloses stdout, freeing the resource.
Ende.stdout.close();
isTerminal
isTerminal(): booleanChecks if stdout is a TTY (terminal).
// This example is system and context specific
Ende.stdout.isTerminal(); // true