Skip to main content
Deno.stderr - Deno documentation
variable Deno.stderr
A reference to `stderr` which can be used to write directly to `stderr`. It implements the Deno specific [`Writer`](https://jsr.io/@std/io/doc/types/~/Writer), [`WriterSync`](https://jsr.io/@std/io/doc/types/~/WriterSync), and [`Closer`](https://jsr.io/@std/io/doc/types/~/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

readonly
writable: WritableStream<Uint8Array>
A writable stream interface to `stderr`.

Methods

write(p: Uint8Array): Promise<number>
Write the contents of the array buffer (`p`) to `stderr`. Resolves to the number of bytes written. **It is not guaranteed that the full buffer will be written in a single call.** ```ts const encoder = new TextEncoder(); const data = encoder.encode("Hello world"); const bytesWritten = await Deno.stderr.write(data); // 11 ```
writeSync(p: Uint8Array): number
Synchronously write the contents of the array buffer (`p`) to `stderr`. Returns the number of bytes written. **It is not guaranteed that the full buffer will be written in a single call.** ```ts const encoder = new TextEncoder(); const data = encoder.encode("Hello world"); const bytesWritten = Deno.stderr.writeSync(data); // 11 ```
close(): void
Closes `stderr`, freeing the resource. ```ts Deno.stderr.close(); ```
isTerminal(): boolean
Checks if `stderr` is a TTY (terminal). ```ts // This example is system and context specific Deno.stderr.isTerminal(); // true ```