Skip to content

Commit

Permalink
feat: accept file name
Browse files Browse the repository at this point in the history
  • Loading branch information
zaida04 committed May 15, 2023
1 parent 7bfa4ea commit 685a9bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 8 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "multer-cloudflare-storage",
"version": "1.0.1",
"version": "1.1.0",
"description": "Multer engine allowing users to upload to Cloudflare Images with ease 🚀",
"author": "Zaid \"Nico\"",
"license": "MIT",
Expand All @@ -16,7 +16,12 @@
"files": [
"dist/"
],
"tags": ["multer", "multer-engine", "multer-storage", "multer-cloudflare"],
"tags": [
"multer",
"multer-engine",
"multer-storage",
"multer-cloudflare"
],
"scripts": {
"build": "npx tsc && npx gen-esm-wrapper . ./dist/index.mjs",
"lint": "npx eslint src/ --ext .ts,.js",
Expand Down Expand Up @@ -55,4 +60,4 @@
"url": "https://github.com/zaida04/multer-cloudflare-storage.git/issues"
},
"homepage": "https://github.com/zaida04/multer-cloudflare-storage.git#readme"
}
}
3 changes: 2 additions & 1 deletion src/multer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class CloudflareStorage implements StorageEngine {

public _handleFile(_req: Request, file: Express.Multer.File, callback: (error: Error | null, info?: Partial<Express.Multer.File>) => void): void {
const body = new FormData();
body.append("file", file.stream);
body.append("file", file.stream, file.originalname);

void fetch(this.destURL, {
method: "POST",
headers: {
Expand Down

0 comments on commit 685a9bb

Please sign in to comment.