Skip to content

Commit

Permalink
fix: allow Uint8Array to put file (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Jan 8, 2023
1 parent 2a14d9a commit 81af059
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ export class Client implements IObjectSimple {
/**
* Add an object to the bucket.
*/
put(name: string, file: string | Buffer | Readable, options?: PutObjectOptions): Promise<PutObjectResult>;
put(name: string, file: string | Buffer | Uint8Array | Readable, options?: PutObjectOptions): Promise<PutObjectResult>;

/**
* Add a stream object to the bucket.
Expand Down
5 changes: 4 additions & 1 deletion index.test-d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SimpleClient implements IObjectSimple {
console.log(query, options);
return {} as any;
}
async put(name: string, file: string | Buffer | Readable, options?: PutObjectOptions): Promise<PutObjectResult> {
async put(name: string, file: string | Buffer | Uint8Array | Readable, options?: PutObjectOptions): Promise<PutObjectResult> {
console.log(name, file, options);
return {} as any;
}
Expand Down Expand Up @@ -81,3 +81,6 @@ expectType<Promise<GetObjectResult>>(clusterClient.get('foo'));

const imageClient = {} as ImageClient;
expectType<Promise<{ content: any; res: NormalSuccessResponse }>>(imageClient.get('foo'));

const bytes = {} as Uint8Array;
expectType<Promise<PutObjectResult>>(simpleClient.put('foo', bytes));

0 comments on commit 81af059

Please sign in to comment.