From ca63ba254ea8766438b9d422f6f94284911f1fa5 Mon Sep 17 00:00:00 2001 From: Michael Novikov <42322636+DennySlick@users.noreply.github.com> Date: Tue, 26 Nov 2024 13:37:46 +0100 Subject: [PATCH] Update types to allow Node.js' `Buffer` for uploads (#674) * feat: Typing support for NodeJS Buffer in lib/index.d.ts I did not test these changes on a Browser engine, but for NodeJS it should work more consistent * Fix linting errors Co-Authored-By: Marius Kleidl --------- Co-authored-by: Marius Kleidl --- lib/index.d.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/index.d.ts b/lib/index.d.ts index bad011f4..31c2bc55 100644 --- a/lib/index.d.ts +++ b/lib/index.d.ts @@ -7,9 +7,12 @@ export const defaultOptions: UploadOptions & // TODO: Consider using { read: () => Promise<{ done: boolean; value?: any; }>; } as type export class Upload { - constructor(file: File | Blob | Pick, options: UploadOptions) + constructor( + file: File | Blob | Buffer | Pick, + options: UploadOptions, + ) - file: File | Blob | Pick + file: File | Blob | Buffer | Pick options: UploadOptions url: string | null