// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.
import { toReadableStream } from "jsr:/@std/io@^0.224.1/to-readable-stream";
/**
 * Create a {@linkcode ReadableStream} of {@linkcode Uint8Array}s from a
 * {@linkcode https://jsr.io/@std/io/doc/types/~/Reader | Reader}.
 *
 * When the pull algorithm is called on the stream, a chunk from the reader
 * will be read.  When `null` is returned from the reader, the stream will be
 * closed along with the reader (if it is also a {@linkcode https://jsr.io/@std/io/doc/types/~/Closer | Closer}).
 *
 * @param reader A reader to convert into a `ReadableStream`.
 * @param options Options for the `readableStreamFromReader` function.
 * @returns A `ReadableStream` of `Uint8Array`s.
 *
 * @example Convert a `Deno.FsFile` into a readable stream:
 * ```ts no-eval no-assert
 * import { readableStreamFromReader } from "@std/streams/readable-stream-from-reader";
 *
 * using file = await Deno.open("./README.md", { read: true });
 * const fileStream = readableStreamFromReader(file);
 * ```
 *
 * @deprecated This will be removed in 1.0.0. Use {@linkcode https://jsr.io/@std/io/doc/~/toReadableStream | toReadableStream} instead.
 */ export function readableStreamFromReader(reader, options = {}) {
  return toReadableStream(reader, options);
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImh0dHBzOi8vanNyLmlvL0BzdGQvc3RyZWFtcy8wLjIyNC41L3JlYWRhYmxlX3N0cmVhbV9mcm9tX3JlYWRlci50cyJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBDb3B5cmlnaHQgMjAxOC0yMDI0IHRoZSBEZW5vIGF1dGhvcnMuIEFsbCByaWdodHMgcmVzZXJ2ZWQuIE1JVCBsaWNlbnNlLlxuLy8gVGhpcyBtb2R1bGUgaXMgYnJvd3NlciBjb21wYXRpYmxlLlxuXG5pbXBvcnQgeyB0b1JlYWRhYmxlU3RyZWFtIH0gZnJvbSBcImpzcjovQHN0ZC9pb0BeMC4yMjQuMS90by1yZWFkYWJsZS1zdHJlYW1cIjtcbmltcG9ydCB0eXBlIHsgQ2xvc2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