method
bun.S3File.slice
begin?: number,
end?: number,
contentType?: string
Creates a new S3File representing a slice of the original file. Uses HTTP Range headers for efficient partial downloads.
@param begin
Starting byte offset
@param end
Ending byte offset (exclusive)
@param contentType
Optional MIME type for the slice
@returns
A new S3File representing the specified range
// Reading file header
const header = file.slice(0, 1024);
const headerText = await header.text();