diff options
author | 2023-02-24 19:08:10 -0600 | |
---|---|---|
committer | 2023-03-01 23:44:20 -0600 | |
commit | c6e0bc3b19442cbec0d74cf218bc15a4cbbc3a00 (patch) | |
tree | 1d6a8cf8d9a2924db0286f015617561523ac7e7a | |
parent | 1be834b073420f4a00a8bb9aaf0de575eb39525d (diff) | |
download | bun-c6e0bc3b19442cbec0d74cf218bc15a4cbbc3a00.tar.gz bun-c6e0bc3b19442cbec0d74cf218bc15a4cbbc3a00.tar.zst bun-c6e0bc3b19442cbec0d74cf218bc15a4cbbc3a00.zip |
feat(stdio): add some `tty.WriteStream` methods
-rw-r--r-- | src/bun.js/builtins/js/ProcessObjectInternals.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/bun.js/builtins/js/ProcessObjectInternals.js b/src/bun.js/builtins/js/ProcessObjectInternals.js index 723528fec..c1898d686 100644 --- a/src/bun.js/builtins/js/ProcessObjectInternals.js +++ b/src/bun.js/builtins/js/ProcessObjectInternals.js @@ -191,6 +191,8 @@ function getStdioWriteStream(fd_, rawRequire) { return normalied === "utf8" || normalied === "utf-8" || normalied === "buffer" || normalied === "binary"; } + var readline; + var FastStdioWriteStream = class StdioWriteStream extends EventEmitter { #fd; #innerStream; @@ -242,6 +244,27 @@ function getStdioWriteStream(fd_, rawRequire) { return (this.#isTTY ??= require("node:tty").isatty(this.#fd)); } + cursorTo(x, y, callback) { + return (readline ??= require("readline")).cursorTo(this, x, y, callback); + } + + moveCursor(dx, dy, callback) { + return (readline ??= require("readline")).moveCursor(this, dx, dy, callback); + } + + clearLine(dir, callback) { + return (readline ??= require("readline")).clearLine(this, dir, callback); + } + + clearScreenDown(callback) { + return (readline ??= require("readline")).clearScreenDown(this, callback); + } + + // TODO: once implemented this.columns and this.rows should be uncommented + // getWindowSize() { + // return [this.columns, this.rows]; + // } + ref() { this.#getWriter().ref(); } |