Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/xdg/vendor/types/deno.d.ts>Deno.isatty

Determine XDG Base Directory paths (OS/platform portable)
Go to Latest
function Deno.isatty
import { Deno } from "https://deno.land/x/xdg@v10.5.1/vendor/types/deno.d.ts";
const { isatty } = Deno;

Check if a given resource id (rid) is a TTY.

// This example is system and context specific
const nonTTYRid = Deno.openSync("my_file.txt").rid;
const ttyRid = Deno.openSync("/dev/tty6").rid;
console.log(Deno.isatty(nonTTYRid)); // false
console.log(Deno.isatty(ttyRid)); // true
Deno.close(nonTTYRid);
Deno.close(ttyRid);

Parameters

rid: number

Returns

boolean