UNPKG

@adonis-agora/media

Version:

Media-library for AdonisJS — owner collections (MIME whitelist, single-file replace, ordering), image conversions (eager/lazy), pluggable content transformers (HLS video via mediabunny, metadata probe, image blur-up placeholder), and column attachments, a

22 lines • 1.29 kB
import type { Readable } from 'node:stream'; /** * Make a GetObject `Body` fail loudly when the underlying connection dies. * * Since response-checksum validation became the SDK default, `res.Body` is a smithy * `ChecksumStream` wired to the socket-backed `IncomingMessage` with a bare legacy * `source.pipe(this)` — which drops source errors. If the connection is killed * mid-stream (S3/MinIO idle timeout while the consumer applies backpressure), the * `IncomingMessage` dies with `aborted`/`errored` set but the Body never emits * anything: every pending read on it hangs forever, and once the Body becomes * unreachable the GC can even collect the consumer's whole suspended await chain, * turning a dropped connection into a silent, permanent freeze. * * The wrapper keeps the wrapped stream as `.source`, so we walk that chain and * bridge every layer down to the socket: * - a layer erroring or closing before its end destroys the Body (pending reads * REJECT instead of hanging); * - the Body being destroyed early (consumer stopped reading) destroys the chain, * releasing the socket instead of leaking it paused with a full buffer. */ export declare function hardenBodyStream(body: Readable): Readable; //# sourceMappingURL=harden_body_stream.d.ts.map