E
Deno.SeekMode
A enum which defines the seek mode for IO related APIs that support
seeking.
f
Deno.consoleSize
Gets the size of the console as columns/rows.
```ts
const { columns, rows } = Deno.consoleSize();
```
This returns the size of the console window as reported by the operating
system. It's not a reflection of how many characters will fit within the
console window, but can be used as part of that calculation.
f
Deno.inspect
Converts the input into a string that has the same format as printed by
`console.log()`.
```ts
const obj = {
a: 10,
b: "hello",
};
const objAsString = Deno.inspect(obj); // { a: 10, b: "hello" }
console.log(obj); // prints same value as objAsString, e.g. { a: 10, b: "hello" }
```
A custom inspect functions can be registered on objects, via the symbol
`Symbol.for("Deno.customInspect")`, to control and customize the output
of `inspect()` or when using `console` logging:
```ts
class A {
x = 10;
y = "hello";
[Symbol.for("Deno.customInspect")]() {
return `x=${this.x}, y=${this.y}`;
}
}
const inStringFormat = Deno.inspect(new A()); // "x=10, y=hello"
console.log(inStringFormat); // prints "x=10, y=hello"
```
A depth can be specified by using the `depth` option:
```ts
Deno.inspect({a: {b: {c: {d: 'hello'}}}}, {depth: 2}); // { a: { b: [Object] } }
```
I
Deno.InspectOptions
Option which can be specified when performing [`Deno.inspect`](./././~/Deno.inspect).
I
v
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`.
v
Deno.stdin
A reference to `stdin` which can be used to read directly from `stdin`.
It implements the Deno specific
[`Reader`](https://jsr.io/@std/io/doc/types/~/Reader),
[`ReaderSync`](https://jsr.io/@std/io/doc/types/~/ReaderSync),
and [`Closer`](https://jsr.io/@std/io/doc/types/~/Closer)
interfaces as well as provides a `ReadableStream` interface.
### Reading chunks from the readable stream
```ts
const decoder = new TextDecoder();
for await (const chunk of Deno.stdin.readable) {
const text = decoder.decode(chunk);
// do something with the text
}
```
v
Deno.stdout
A reference to `stdout` which can be used to write directly to `stdout`.
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`.