Skip to content

Commit f115b91

Browse files
matttaron
andcommitted
Apply suggestions from code review
Co-authored-by: Aron Carroll <[email protected]>
1 parent db66ee7 commit f115b91

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

index.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ declare module "replicate" {
4646
size: number;
4747
etag: string;
4848
checksum: string;
49-
metadata: Record<string, any>;
49+
metadata: Record<string, unknown>;
5050
created_at: string;
5151
expires_at: string | null;
5252
urls: {

lib/files.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ async function createFile(file, metadata = {}) {
1111
let filename;
1212
let blob;
1313
if (file instanceof Blob) {
14-
fileName = file.name || `blob_${Date.now()}`;
14+
filename = file.name || `blob_${Date.now()}`;
1515
blob = file;
1616
} else if (Buffer.isBuffer(file)) {
17-
fileName = `buffer_${Date.now()}`;
17+
filename = `buffer_${Date.now()}`;
1818
blob = new Blob(file, { type: "application/octet-stream" });
1919
} else {
20-
throw new Error("Invalid file argument, must be a Blob or File");
20+
throw new Error("Invalid file argument, must be a Blob, File or Buffer");
2121
}
2222

2323
form.append("content", blob, filename);

0 commit comments

Comments
 (0)