@vuebro/fsa 1.0.1 → 1.0.2
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/README.md +1 -10
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,14 +40,7 @@ Note: Support in other browsers may vary. Check [caniuse.com](https://caniuse.co
|
|
|
40
40
|
|
|
41
41
|
The library provides the following functions:
|
|
42
42
|
|
|
43
|
-
### `getHandle(Bucket, Key, create?)`
|
|
44
43
|
|
|
45
|
-
Gets a file or directory handle from the file system
|
|
46
|
-
|
|
47
|
-
- `Bucket` - The root directory handle (`FileSystemDirectoryHandle`)
|
|
48
|
-
- `Key` - The path to the file or directory (string)
|
|
49
|
-
- `create` - Whether to create the directory if it doesn't exist (boolean, optional, default: false)
|
|
50
|
-
- Returns: Promise resolving to `FileSystemDirectoryHandle | FileSystemFileHandle | undefined`
|
|
51
44
|
|
|
52
45
|
### `deleteObject(Bucket, Key)`
|
|
53
46
|
|
|
@@ -104,7 +97,6 @@ First, you'll need to get a directory handle from the user using the File System
|
|
|
104
97
|
|
|
105
98
|
```javascript
|
|
106
99
|
import {
|
|
107
|
-
getHandle,
|
|
108
100
|
putObject,
|
|
109
101
|
getObjectText,
|
|
110
102
|
deleteObject,
|
|
@@ -138,8 +130,7 @@ try {
|
|
|
138
130
|
// Example: Delete a file
|
|
139
131
|
await deleteObject(directoryHandle, 'path/to/file.txt');
|
|
140
132
|
|
|
141
|
-
|
|
142
|
-
const handle = await getHandle(directoryHandle, 'path/to/directory');
|
|
133
|
+
|
|
143
134
|
|
|
144
135
|
// Example: Remove empty directories (excluding specific ones)
|
|
145
136
|
await removeEmptyDirectories(directoryHandle, ['.git', 'node_modules']);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,2 @@
|
|
|
1
1
|
import type { StreamingBlobPayloadInputTypes } from "@smithy/types";
|
|
2
|
-
declare const
|
|
3
|
-
declare const deleteObject: (Bucket: FileSystemDirectoryHandle, Key: string) => Promise<void>, getObjectBlob: (Bucket: FileSystemDirectoryHandle, Key: string) => Promise<Blob>, getObjectText: (Bucket: FileSystemDirectoryHandle, Key: string) => Promise<string>, headObject: (Bucket: FileSystemDirectoryHandle, Key: string) => Promise<undefined>, putObject: (Bucket: FileSystemDirectoryHandle, Key: string, body: StreamingBlobPayloadInputTypes) => Promise<void>, removeEmptyDirectories: (directory: FileSystemDirectoryHandle, exclude: string[]) => Promise<void>;
|
|
4
|
-
export { deleteObject, getHandle, getObjectBlob, getObjectText, headObject, putObject, removeEmptyDirectories, };
|
|
2
|
+
export declare const deleteObject: (Bucket: FileSystemDirectoryHandle, Key: string) => Promise<void>, getObjectBlob: (Bucket: FileSystemDirectoryHandle, Key: string) => Promise<Blob>, getObjectText: (Bucket: FileSystemDirectoryHandle, Key: string) => Promise<string>, headObject: (Bucket: FileSystemDirectoryHandle, Key: string) => Promise<undefined>, putObject: (Bucket: FileSystemDirectoryHandle, Key: string, body: StreamingBlobPayloadInputTypes) => Promise<void>, removeEmptyDirectories: (directory: FileSystemDirectoryHandle, exclude: string[]) => Promise<void>;
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ const getHandle = (Bucket, Key, create = false) => Key.split("/").reduce(async (
|
|
|
17
17
|
}
|
|
18
18
|
return;
|
|
19
19
|
}, Promise.resolve(Bucket));
|
|
20
|
-
const deleteObject = async (Bucket, Key) => {
|
|
20
|
+
export const deleteObject = async (Bucket, Key) => {
|
|
21
21
|
const keys = Key.split("/"), name = keys.pop();
|
|
22
22
|
if (name) {
|
|
23
23
|
const handle = await getHandle(Bucket, keys.join("/"));
|
|
@@ -54,4 +54,3 @@ const deleteObject = async (Bucket, Key) => {
|
|
|
54
54
|
await Promise.allSettled(values.map(({ name }) => directory.removeEntry(name)));
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
|
-
export { deleteObject, getHandle, getObjectBlob, getObjectText, headObject, putObject, removeEmptyDirectories, };
|