@medusajs/file-local-next 0.0.3-snapshot-20240531094527 → 0.0.3-snapshot-20240607093839
Sign up to get free protection for your applications and to get access to all the features.
@@ -16,7 +16,7 @@ class LocalFileService extends utils_1.AbstractFileProviderService {
|
|
16
16
|
this.getUploadFileUrl = (fileKey) => {
|
17
17
|
return path_1.default.join(this.backendUrl_, this.getUploadFilePath(fileKey));
|
18
18
|
};
|
19
|
-
this.uploadDir_ = options?.upload_dir || "uploads";
|
19
|
+
this.uploadDir_ = options?.upload_dir || path_1.default.join(__dirname, "uploads");
|
20
20
|
this.backendUrl_ = options?.backend_url || "http://localhost:9000";
|
21
21
|
}
|
22
22
|
async upload(file) {
|
@@ -27,9 +27,7 @@ class LocalFileService extends utils_1.AbstractFileProviderService {
|
|
27
27
|
throw new utils_1.MedusaError(utils_1.MedusaError.Types.INVALID_DATA, `No filename provided`);
|
28
28
|
}
|
29
29
|
const parsedFilename = path_1.default.parse(file.filename);
|
30
|
-
|
31
|
-
this.ensureDirExists(parsedFilename.dir);
|
32
|
-
}
|
30
|
+
await this.ensureDirExists(parsedFilename.dir);
|
33
31
|
const fileKey = path_1.default.join(parsedFilename.dir, `${Date.now()}-${parsedFilename.base}`);
|
34
32
|
const filePath = this.getUploadFilePath(fileKey);
|
35
33
|
const fileUrl = this.getUploadFileUrl(fileKey);
|
@@ -72,4 +70,4 @@ class LocalFileService extends utils_1.AbstractFileProviderService {
|
|
72
70
|
}
|
73
71
|
exports.LocalFileService = LocalFileService;
|
74
72
|
LocalFileService.identifier = "localfs";
|
75
|
-
//# sourceMappingURL=data:application/json;base64,
|
73
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9jYWwtZmlsZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9zZXJ2aWNlcy9sb2NhbC1maWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7OztBQUNBLDJDQUEwRTtB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HLFNBQVMsQ0FBQSJ9
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@medusajs/file-local-next",
|
3
|
-
"version": "0.0.3-snapshot-
|
3
|
+
"version": "0.0.3-snapshot-20240607093839",
|
4
4
|
"description": "Local filesystem file storage for Medusa",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"repository": {
|
@@ -29,7 +29,7 @@
|
|
29
29
|
"typescript": "^4.9.5"
|
30
30
|
},
|
31
31
|
"dependencies": {
|
32
|
-
"@medusajs/utils": "1.12.0-snapshot-
|
32
|
+
"@medusajs/utils": "1.12.0-snapshot-20240607093839"
|
33
33
|
},
|
34
34
|
"keywords": [
|
35
35
|
"medusa-plugin",
|