import timers from 'timers/promises';
import strip_ansi from 'strip-ansi';
import { set_platform } from "./platform.common.js";
export * from "./platform.common.js";
function get_buffer(length) {
    return Buffer.allocUnsafe(length);
}
function encode(str) {
    // 用 Buffer.from 是因为可以利用 buffer pool，避免 encoder.encode 创建大量小且独立的 array buffer
    return Buffer.from(str);
}
async function delay(milliseconds, options) {
    return timers.setTimeout(milliseconds, undefined, options);
}
set_platform({
    get_buffer,
    encode,
    delay,
    strip_ansi
});
//# sourceMappingURL=platform.js.map