UNPKG

@strapi/data-transfer

Version:

Data transfer capabilities for Strapi

17 lines 877 B
/// <reference types="node" /> import type { Writable } from 'stream'; /** * Async helper for application code that `await`s sequential writes to a `Writable`. * * 1. Waits until `writable.write` invokes its callback (chunk accepted / `_write` finished). * 2. If `write()` returned `false` **and** `writable.writableNeedDrain` is still true after the * callback, waits for `'drain'`. * * We check both: the return value tells us backpressure was signaled; `writableNeedDrain` avoids * awaiting `'drain'` when it already fired before we subscribed (would otherwise hang forever). * * While waiting for `'drain'`, we also race {@link finished} so destroying the writable (e.g. abort) * cannot leave this promise pending forever. */ export declare function write(writable: Writable, chunk: unknown): Promise<void>; //# sourceMappingURL=writable-async-write.d.ts.map