f2u-cli 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +25 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -62,7 +62,29 @@ import { existsSync } from "fs";
62
62
 
63
63
  // src/api-client.ts
64
64
  import { readFileSync as readFileSync2 } from "fs";
65
- import { basename } from "path";
65
+ import { basename, extname } from "path";
66
+ var MIME_TYPES = {
67
+ ".jpg": "image/jpeg",
68
+ ".jpeg": "image/jpeg",
69
+ ".png": "image/png",
70
+ ".gif": "image/gif",
71
+ ".webp": "image/webp",
72
+ ".svg": "image/svg+xml",
73
+ ".pdf": "application/pdf",
74
+ ".json": "application/json",
75
+ ".txt": "text/plain",
76
+ ".html": "text/html",
77
+ ".css": "text/css",
78
+ ".js": "text/javascript",
79
+ ".ts": "text/typescript",
80
+ ".csv": "text/csv",
81
+ ".xml": "application/xml",
82
+ ".zip": "application/zip",
83
+ ".mp4": "video/mp4",
84
+ ".mp3": "audio/mpeg",
85
+ ".wav": "audio/wav",
86
+ ".md": "text/markdown"
87
+ };
66
88
  var ApiClient = class {
67
89
  baseUrl;
68
90
  headers;
@@ -91,7 +113,8 @@ var ApiClient = class {
91
113
  async upload(filePath, ttl) {
92
114
  const fileBuffer = readFileSync2(filePath);
93
115
  const filename = basename(filePath);
94
- const blob = new Blob([fileBuffer]);
116
+ const mimeType = MIME_TYPES[extname(filePath).toLowerCase()] || "application/octet-stream";
117
+ const blob = new Blob([fileBuffer], { type: mimeType });
95
118
  const form = new FormData();
96
119
  form.append("file", blob, filename);
97
120
  form.append("ttl", ttl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "f2u-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "CLI tool for AI agents to upload temporary files to Cloudflare R2",
5
5
  "type": "module",
6
6
  "bin": {