diff options
author | Asher Gomez <ashersaupingomez@gmail.com> | 2024-02-19 01:27:44 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-18 07:27:44 -0700 |
commit | c1fac11dfaf9d656b7361708d9faab1916eac846 (patch) | |
tree | 151c729aa2774c21924b0bb8a1c6aa6daffea854 /ext/fs/30_fs.js | |
parent | 7abd72a80f0aafe071ad7d298b48e0da741cc9f3 (diff) |
feat(fs): `Deno.FsFile.{isTerminal,setRaw}()` (#22234)
Closes #22229.
---------
Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
Diffstat (limited to 'ext/fs/30_fs.js')
-rw-r--r-- | ext/fs/30_fs.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/ext/fs/30_fs.js b/ext/fs/30_fs.js index 46358c42a..2efb0a878 100644 --- a/ext/fs/30_fs.js +++ b/ext/fs/30_fs.js @@ -72,6 +72,8 @@ import { op_fs_utime_sync, op_fs_write_file_async, op_fs_write_file_sync, + op_is_terminal, + op_set_raw, } from "ext:core/ops"; const { ArrayPrototypeFilter, @@ -766,6 +768,15 @@ class FsFile { futimeSync(this.#rid, atime, mtime); } + isTerminal() { + return op_is_terminal(this.#rid); + } + + setRaw(mode, options = {}) { + const cbreak = !!(options.cbreak ?? false); + op_set_raw(this.#rid, mode, cbreak); + } + lockSync(exclusive = false) { op_fs_flock_sync(this.#rid, exclusive); } |