import { Writable, Transform, type Readable, type Duplex, type TransformCallback } from 'stream';
import util from '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;
export declare function set_inspect_options(colors?: boolean): void;
export declare function typed_array_to_buffer(view: ArrayBufferView): Buffer<ArrayBufferLike>;
/** 每天在固定时间执行操作
    - hour: 0 - 23 之间的整数，在这个点执行
    - action */
export declare function schedule_everyday(hour: number, action: () => Promise<void>): Promise<void>;
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 has_chinese(str: string): boolean;
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;
/** 根据 enabled 选项返回有 / 无颜色的字符串 (str) */
export declare function colored(str: string, color: string, enabled?: boolean): any;
export declare namespace inspect {
    const custom: typeof util.inspect.custom;
    const defaultOptions: util.InspectOptions;
}
/** npm map-stream
    filter will reemit the data if cb(err,pass) pass is truthy
    
    reduce is more tricky
    maybe we want to group the reductions or emit progress updates occasionally
    the most basic reduce just emits one 'data' event after it has recieved 'end'
    
    create an event stream and apply function to each .write,
    emitting each response as data unless it's an empty callback
 */
export declare function map_stream<Out, In = any>(mapper: (obj: In, cb: Function) => any, options?: {
    failures?: boolean;
}): Duplex;
export declare function stream_to_lines(stream: Readable): AsyncGenerator<string, void, unknown>;
export declare function pipe_with_error<TWritable extends Writable>(readable: Readable, writable: TWritable): TWritable;
export declare class WritableMemoryStream extends Writable {
    chunks: Uint8Array[];
    pbuffer: import("./utils.common.ts").Deferred<Buffer<ArrayBufferLike>>;
    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;
}
/** 消费一个可读流 */
export declare function consume_stream(stream: Readable, ignore_error?: boolean): Promise<void>;
/** 根据 range 生成整数序列 (iterable)
    - range: 取值为逗号分割的多个可用值或值区间 (不能含有空格)，比如：`8321,8322,8300-8310,11000-11999`
    - reverse?: `false` 在 range 内从后往前生成 */
export declare function range_to_numbers(range: string, reverse?: boolean): Generator<number, void, unknown>;
export declare function decode_buffer_hex_string(str: string): string;
