Skip to content

Commit

Permalink
Update types to allow Node.js' Buffer for uploads (#674)
Browse files Browse the repository at this point in the history
* 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 <marius@transloadit.com>

---------

Co-authored-by: Marius Kleidl <marius@transloadit.com>
  • Loading branch information
DennySlick and Acconut authored Nov 26, 2024
1 parent f20ef3c commit ca63ba2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ReadableStreamDefaultReader, 'read'>, options: UploadOptions)
constructor(
file: File | Blob | Buffer | Pick<ReadableStreamDefaultReader, 'read'>,
options: UploadOptions,
)

file: File | Blob | Pick<ReadableStreamDefaultReader, 'read'>
file: File | Blob | Buffer | Pick<ReadableStreamDefaultReader, 'read'>
options: UploadOptions
url: string | null

Expand Down

0 comments on commit ca63ba2

Please sign in to comment.