From cb8af3a4e7b077f2a68bf94b4f68d348ab682725 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Tue, 7 Mar 2023 22:34:28 -0800 Subject: [PATCH] Fix types --- packages/bun-types/bun.d.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/bun-types/bun.d.ts b/packages/bun-types/bun.d.ts index 7c43ebd3a2..3773d3ebb4 100644 --- a/packages/bun-types/bun.d.ts +++ b/packages/bun-types/bun.d.ts @@ -620,8 +620,26 @@ declare module "bun" { * * @param begin - start offset in bytes * @param end - absolute offset in bytes (relative to 0) + * @param contentType - MIME type for the new FileBlob */ - slice(begin?: number, end?: number): FileBlob; + slice(begin?: number, end?: number, contentType?: string): FileBlob; + + /** + * Offset any operation on the file starting at `begin` + * + * Similar to [`TypedArray.subarray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray). Does not copy the file, open the file, or modify the file. + * + * If `begin` > 0, {@link Bun.write()} will be slower on macOS + * + * @param begin - start offset in bytes + * @param contentType - MIME type for the new FileBlob + */ + slice(begin?: number, contentType?: string): FileBlob; + + /** + * @param contentType - MIME type for the new FileBlob + */ + slice(contentType?: string): FileBlob; /** * Incremental writer for files and pipes.