@vuebro/fsa 1.0.18 → 1.0.20
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.
- package/dist/index.js +11 -5
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -30,20 +30,26 @@ export const deleteObject = async (Bucket, Key) => {
|
|
|
30
30
|
const handle = await getHandle(Bucket, Key);
|
|
31
31
|
if (handle?.kind === "file")
|
|
32
32
|
return handle.getFile();
|
|
33
|
-
|
|
33
|
+
else
|
|
34
|
+
return new Blob();
|
|
34
35
|
}, getObjectText = async (Bucket, Key) => (await getObjectBlob(Bucket, Key)).text(), headObject = async (Bucket, Key) => {
|
|
35
36
|
const handle = await getHandle(Bucket, Key);
|
|
36
37
|
if (handle?.kind === "file")
|
|
37
38
|
return undefined;
|
|
38
|
-
|
|
39
|
+
else
|
|
40
|
+
throw new Error("It's not a file");
|
|
39
41
|
}, putObject = async (Bucket, Key, body) => {
|
|
40
42
|
const keys = Key.split("/"), name = keys.pop();
|
|
41
43
|
if (name) {
|
|
42
44
|
const handle = await getHandle(Bucket, keys.join("/"), true);
|
|
43
45
|
if (handle?.kind === "directory") {
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
const writable = await (await handle.getFileHandle(name, { create: true })).createWritable();
|
|
47
|
+
try {
|
|
48
|
+
await writable.write(body);
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
await writable.close();
|
|
52
|
+
}
|
|
47
53
|
}
|
|
48
54
|
}
|
|
49
55
|
}, removeEmptyDirectories = async (directory, exclude) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://www.schemastore.org/package",
|
|
3
3
|
"name": "@vuebro/fsa",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.20",
|
|
5
5
|
"description": "A TypeScript library providing a File System Access API wrapper for web applications. Offers AWS S3-like operations (get, put, delete, head) to interact with local file systems efficiently in modern browsers.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"file-system-access",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@smithy/types": "^4.11.0",
|
|
45
45
|
"@types/node": "^25.0.3",
|
|
46
|
-
"@vuebro/configs": "^1.2.
|
|
46
|
+
"@vuebro/configs": "^1.2.34",
|
|
47
47
|
"eslint": "^9.39.2"
|
|
48
48
|
}
|
|
49
49
|
}
|