import { Readable, Writable, Transform, type TransformCallback } from 'node:stream'; import util from 'node:util'; import './prototype.ts'; import './platform.ts'; export * from './utils.common.ts'; /** `180` 输出字符宽度 */ export declare const output_width = 180; export declare const url_width = 52; /** - colors?: `true` */ export declare function set_inspect_options(colors?: boolean): void; export declare function typed_array_to_buffer(view: ArrayBufferView): Buffer; export declare function log_line(): void; export declare function sha256(data: string | Uint8Array): string; export declare function sha1(data: string | Uint8Array): string; export declare function crc32(data: string | Uint8Array): string; export declare function escape_line_feed(str: string): string; /** util.inspect(obj) - options - limit?: `10000` 传 0 时不限制 - omit?: string[] */ export declare function inspect(obj: any, options?: util.InspectOptions & { limit?: number; omit?: string[]; }): string; export declare namespace inspect { var custom: symbol; var defaultOptions: util.InspectOptions; } export interface inspect { custom: typeof util.inspect.custom; defaultOptions: typeof util.inspect.defaultOptions; } /** 根据 enabled 选项返回有 / 无颜色的字符串 (str) */ export declare function colored(str: string, color: string, enabled?: boolean): any; export declare function is_readable_stream(stream: any): boolean; /** 消费一个可读流 */ export declare function consume_stream(stream: Readable, ignore_error?: boolean): Promise; export declare function stream_to_lines(stream: Readable): AsyncGenerator; export declare class WritableMemoryStream extends Writable { chunks: Uint8Array[]; pbuffer: import("./utils.common.ts").Deferred>; constructor(); _write(chunk: Uint8Array, encoding: BufferEncoding, callback: (error?: Error) => void): void; _writev(chunks: { chunk: any; encoding: BufferEncoding; }[], callback: (error?: Error) => void): void; _final(callback: (error?: Error) => void): void; } /** 用 TextDecoder 通过 .pipe 方法持续的解码 process.stdout 等流, 主要在 process.ts#start 中使用 https://nodejs.org/api/stream.html#implementing-a-transform-stream */ export declare class DecoderStream extends Transform { decoder: TextDecoder; constructor(encoding: 'gb18030' | 'shift-jis' | 'utf-16le'); _transform(chunk: Uint8Array, encoding: BufferEncoding, callback: TransformCallback): void; _flush(callback: TransformCallback): void; } /** 返回一个 transform 流,来截取可读流的前 nbytes 字节 */ export declare function slice_stream(nbytes: number): Transform; /** 根据 range 生成整数序列 (iterable) - range: 取值为逗号分割的多个可用值或值区间 (不能含有空格),比如:`8321,8322,8300-8310,11000-11999` - reverse?: `false` 在 range 内从后往前生成 */ export declare function range_to_numbers(range: string, reverse?: boolean): Generator; export declare function decode_buffer_hex_string(str: string): string;