dax
Version:
Cross platform shell tools inspired by zx.
35 lines • 1.71 kB
TypeScript
import * as dntShim from "../../../../../../_dnt.shims.js";
/** Process-level stdin abstraction. */
export interface Stdin {
/** Reads up to `p.length` bytes into `p`, returning the number of bytes
* read or `null` on EOF. When `signal` is provided and aborts before a
* read completes, the returned promise rejects with `signal.reason` and
* any bytes that arrive afterwards stay buffered for the next `read`. */
read(p: Uint8Array, options?: {
signal?: AbortSignal;
}): Promise<number | null>;
/** A `ReadableStream` view of stdin, backed by {@link read} so it shares
* the same fd without locking it. Cached so repeated access shares the
* same stream until it is cancelled. */
readonly readable: dntShim.ReadableStream<Uint8Array>;
/** Toggles raw mode on stdin when it is attached to a TTY. */
setRaw(mode: boolean): void;
/** Returns whether stdin is attached to a TTY. */
isTerminal(): boolean;
}
/** Process-level stdout/stderr abstraction. */
export interface Stdout {
/** Synchronously writes the provided bytes, returning how many were written. */
writeSync(p: Uint8Array): number;
/** Returns whether the stream is attached to a TTY. */
isTerminal(): boolean;
}
/** Process-level stderr abstraction. Same shape as {@link Stdout}. */
export type Stderr = Stdout;
/** Default {@link Stdin} bound to the host process's stdin fd. */
export declare const stdin: Stdin;
/** Default {@link Stdout} bound to the host process's stdout fd. */
export declare const stdout: Stdout;
/** Default {@link Stderr} bound to the host process's stderr fd. */
export declare const stderr: Stderr;
//# sourceMappingURL=streams.d.ts.map