1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00
denoland-deno/runtime/js/40_tty.js
Asher Gomez c1fac11dfa
feat(fs): Deno.FsFile.{isTerminal,setRaw}() (#22234)
Closes #22229.

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
2024-02-18 07:27:44 -07:00

24 lines
673 B
JavaScript

// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { internals, primordials } from "ext:core/mod.js";
import { op_console_size, op_is_terminal } from "ext:core/ops";
const {
Uint32Array,
} = primordials;
const size = new Uint32Array(2);
function consoleSize() {
op_console_size(size);
return { columns: size[0], rows: size[1] };
}
function isatty(rid) {
internals.warnOnDeprecatedApi(
"Deno.isatty()",
new Error().stack,
"Use `Deno.stdin.isTerminal()`, `Deno.stdout.isTerminal()`, `Deno.stderr.isTerminal()` or `Deno.FsFile.isTerminal()` instead.",
);
return op_is_terminal(rid);
}
export { consoleSize, isatty };