method

bun.S3File.slice

begin?: number,
end?: number,
contentType?: string
): S3File;

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();
begin?: number,
contentType?: string
): S3File;
contentType?: string
): S3File;