This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.
Search the reference...
/
type
Represents a raw buffer of binary data, which is used to store data for the different typed arrays. ArrayBuffers cannot be read from or written to directly, but can be passed to a typed array or DataView Object to interpret the raw buffer as needed.
Read-only. The length of the ArrayBuffer (in bytes).
Resizes the ArrayBuffer to the specified size (in bytes).
Resize an ArrayBuffer in-place.
Returns a section of an ArrayBuffer.
Creates a new ArrayBuffer with the same byte content as this buffer, then detaches this buffer.
Creates a new non-resizable ArrayBuffer with the same byte content as this buffer, then detaches this buffer.
Apply EXIF Orientation (JPEG) before any other operation.
Reject inputs whose width × height exceeds this many pixels. The check runs after the header is read but before any pixel buffer is allocated, so a tiny file claiming a huge canvas is refused cheaply.
Multiplier; 1 leaves brightness unchanged.
0 = greyscale, 1 = unchanged, >1 = more saturated.
Resampling kernel.
"fill" stretches to exactly width×height. "inside" preserves aspect ratio so the result fits within width×height.
Never upscale — if the source is already smaller, leave it.
Stable error.code values set on rejections from Bun.Image terminals. Branch on these instead of parsing the message.
ERR_IMAGE_FORMAT_UNSUPPORTED — the requested format isn't available on this machine (HEIC/AVIF without the OS codec, TIFF on Linux). Catch this to fall back to a portable format.ERR_IMAGE_TOO_MANY_PIXELS — header dimensions or resize output exceed maxPixels, or a path-backed input is over the 256 MiB cap.ERR_IMAGE_DECODE_FAILED / ERR_IMAGE_ENCODE_FAILED — codec error.ERR_IMAGE_UNKNOWN_FORMAT — input bytes didn't match any sniffer.ERR_INVALID_STATE — the input ArrayBuffer was transferred between construction and the terminal call.File-backed inputs surface the underlying syscall code (ENOENT, EACCES, …) directly.bmp/tiff/gif are decode-only — metadata().format may report them but there are no .bmp()/.tiff()/.gif() encoder methods. tiff decode rejects with error.code === "ERR_IMAGE_FORMAT_UNSUPPORTED" on Linux; gif decodes the first frame everywhere.
Resources
ReferenceDocsGuidesDiscordMerch StoreGitHubBlogToolkit
RuntimePackage managerTest runnerBundlerPackage runnerProject
Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicenseBaked with ❤️ in San Francisco
We're hiring →Bun.BodyInit TypeScript type alias | API Reference | Bun,AI智能索引,全网链接索引,智能导航,网页索引
- API documentation for type bun.BodyInit | Bun