import { ExactBytesTransformStream } from "https://deno.land/x/stream_slicing@v1.1.0/exact_bytes_transform_stream.ts";
A TransformStream that will only read & enqueue size
amount of bytes,
and will error if piped more or less than size
bytes.
import { ExactBytesTransformStream } from "./exact_bytes_transform_stream.ts";
const fileUrl = new URL("./test.txt", import.meta.url);
const stat = await Deno.stat(fileUrl);
const res = await fetch(fileUrl.href);
const parts = res.body!
.pipeThrough(new ExactBytesTransformStream(stat.size));