import { PartialReader } from "https://deno.land/x/stream_slicing@v1.1.0/partial_reader.ts";
Methods
Cancel the ReadableStream reader. This may cause any in-progress or future reads to throw an error or think that the end of the stream has been reached.
Equivalent to ReadableStreamDefaultReader.read except that a maximum size is provided, and if the underlying read() result is greater than the maximum size, then the extra data will be buffered for later.
Reads and returns size
bytes from the stream, or less if the stream ends.
Reads and returns exactly size
bytes from the stream.
Throws an error if the reader ends before filling the buffer.
Skips size
bytes of the stream.
Uses PartialReaderOptions.seek to seek the stream if available, otherwise
does it by reading bytes from the stream and ignoring the result.
Returns a ReadableStream that the underlying reader is redirected to for the
next size
bytes.
If you want to assert that the returned stream outputs size
bytes without ending early,
then use .pipeThrough(new ExactBytesTransformStream(size))
on the result.
Static Methods
Construct a PartialReader from a ReadableStream.
Internally this will return a subclass of PartialReader based on whether the stream
supports byob mode ("bring your own buffer") readers, which are more efficient for some
use-cases.
If the stream is seekable, then pass a callback to PartialReaderOptions.seek to enable efficient seeking.