@fgv/ts-web-extras 5.0.2 → 5.1.0-0
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/.rush/temp/81e0881271ff236956b2f52e8ca99da6574c6e1e.tar.log +223 -0
- package/.rush/temp/chunked-rush-logs/ts-web-extras.build.chunks.jsonl +35 -25
- package/.rush/temp/operation/build/all.log +35 -25
- package/.rush/temp/operation/build/log-chunks.jsonl +35 -25
- package/.rush/temp/operation/build/state.json +1 -1
- package/.rush/temp/shrinkwrap-deps.json +175 -163
- package/config/jest.config.json +4 -1
- package/config/typedoc.json +6 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/packlets/crypto-utils/browserCryptoProvider.js +254 -0
- package/dist/packlets/crypto-utils/browserCryptoProvider.js.map +1 -0
- package/dist/packlets/crypto-utils/browserHashProvider.js.map +1 -0
- package/dist/packlets/{crypto → crypto-utils}/index.js +1 -0
- package/dist/packlets/crypto-utils/index.js.map +1 -0
- package/dist/packlets/file-api-types/index.js +27 -3
- package/dist/packlets/file-api-types/index.js.map +1 -1
- package/dist/packlets/file-tree/directoryHandleStore.js +124 -0
- package/dist/packlets/file-tree/directoryHandleStore.js.map +1 -0
- package/dist/packlets/file-tree/fileApiTreeAccessors.js +76 -0
- package/dist/packlets/file-tree/fileApiTreeAccessors.js.map +1 -1
- package/dist/packlets/file-tree/fileSystemAccessTreeAccessors.js +345 -0
- package/dist/packlets/file-tree/fileSystemAccessTreeAccessors.js.map +1 -0
- package/dist/packlets/file-tree/index.js +3 -0
- package/dist/packlets/file-tree/index.js.map +1 -1
- package/dist/packlets/file-tree/localStorageTreeAccessors.js +308 -0
- package/dist/packlets/file-tree/localStorageTreeAccessors.js.map +1 -0
- package/dist/test/mocks/idb-keyval.js +6 -0
- package/dist/test/mocks/idb-keyval.js.map +1 -0
- package/dist/test/unit/browserHashProvider.test.js +1 -1
- package/dist/test/unit/browserHashProvider.test.js.map +1 -1
- package/dist/test/unit/directoryHandleStore.test.js +190 -0
- package/dist/test/unit/directoryHandleStore.test.js.map +1 -0
- package/dist/test/unit/fileApiTypes.test.js +30 -0
- package/dist/test/unit/fileApiTypes.test.js.map +1 -1
- package/dist/test/unit/fileSystemAccessTreeAccessors.test.js +517 -0
- package/dist/test/unit/fileSystemAccessTreeAccessors.test.js.map +1 -0
- package/dist/test/unit/localStorageTreeAccessors.test.js +595 -0
- package/dist/test/unit/localStorageTreeAccessors.test.js.map +1 -0
- package/dist/test/utils/fileSystemAccessMocks.js +271 -0
- package/dist/test/utils/fileSystemAccessMocks.js.map +1 -0
- package/dist/ts-web-extras.d.ts +460 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/docs/ts-web-extras.cryptoutils.browsercryptoprovider._constructor_.md +50 -0
- package/docs/ts-web-extras.cryptoutils.browsercryptoprovider.decrypt.md +104 -0
- package/docs/ts-web-extras.cryptoutils.browsercryptoprovider.derivekey.md +88 -0
- package/docs/ts-web-extras.cryptoutils.browsercryptoprovider.encrypt.md +72 -0
- package/docs/ts-web-extras.cryptoutils.browsercryptoprovider.frombase64.md +56 -0
- package/docs/ts-web-extras.cryptoutils.browsercryptoprovider.generatekey.md +19 -0
- package/docs/ts-web-extras.cryptoutils.browsercryptoprovider.generaterandombytes.md +56 -0
- package/docs/ts-web-extras.cryptoutils.browsercryptoprovider.md +169 -0
- package/docs/ts-web-extras.cryptoutils.browsercryptoprovider.tobase64.md +56 -0
- package/docs/{ts-web-extras.browserhashprovider.hashparts.md → ts-web-extras.cryptoutils.browserhashprovider.hashparts.md} +2 -2
- package/docs/{ts-web-extras.browserhashprovider.hashstring.md → ts-web-extras.cryptoutils.browserhashprovider.hashstring.md} +2 -2
- package/docs/{ts-web-extras.browserhashprovider.md → ts-web-extras.cryptoutils.browserhashprovider.md} +4 -4
- package/docs/ts-web-extras.cryptoutils.createbrowsercryptoprovider.md +19 -0
- package/docs/ts-web-extras.cryptoutils.md +71 -0
- package/docs/ts-web-extras.fileapitreeaccessors.createfromlocalstorage.md +74 -0
- package/docs/ts-web-extras.fileapitreeaccessors.createpersistent.md +76 -0
- package/docs/ts-web-extras.fileapitreeaccessors.md +32 -0
- package/docs/ts-web-extras.filesystemaccesstreeaccessors._constructor_.md +114 -0
- package/docs/ts-web-extras.filesystemaccesstreeaccessors.fileismutable.md +52 -0
- package/docs/ts-web-extras.filesystemaccesstreeaccessors.fromdirectoryhandle.md +72 -0
- package/docs/ts-web-extras.filesystemaccesstreeaccessors.getdirtypaths.md +17 -0
- package/docs/ts-web-extras.filesystemaccesstreeaccessors.isdirty.md +17 -0
- package/docs/ts-web-extras.filesystemaccesstreeaccessors.md +159 -0
- package/docs/ts-web-extras.filesystemaccesstreeaccessors.savefilecontents.md +66 -0
- package/docs/ts-web-extras.filesystemaccesstreeaccessors.synctodisk.md +17 -0
- package/docs/ts-web-extras.ifilesystemaccesstreeparams.autosync.md +13 -0
- package/docs/ts-web-extras.ifilesystemaccesstreeparams.md +78 -0
- package/docs/ts-web-extras.ifilesystemaccesstreeparams.requirewritepermission.md +13 -0
- package/docs/ts-web-extras.ilocalstoragetreeparams.autosync.md +13 -0
- package/docs/ts-web-extras.ilocalstoragetreeparams.md +97 -0
- package/docs/ts-web-extras.ilocalstoragetreeparams.pathtokeymap.md +13 -0
- package/docs/ts-web-extras.ilocalstoragetreeparams.storage.md +13 -0
- package/docs/ts-web-extras.localstoragetreeaccessors.fileismutable.md +56 -0
- package/docs/ts-web-extras.localstoragetreeaccessors.fromstorage.md +56 -0
- package/docs/ts-web-extras.localstoragetreeaccessors.getdirtypaths.md +19 -0
- package/docs/ts-web-extras.localstoragetreeaccessors.isdirty.md +19 -0
- package/docs/ts-web-extras.localstoragetreeaccessors.md +131 -0
- package/docs/ts-web-extras.localstoragetreeaccessors.savefilecontents.md +72 -0
- package/docs/ts-web-extras.localstoragetreeaccessors.synctodisk.md +19 -0
- package/docs/ts-web-extras.md +50 -4
- package/etc/ts-web-extras.api.md +91 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +25 -2
- package/lib/index.js.map +1 -1
- package/lib/packlets/crypto-utils/browserCryptoProvider.d.ts +77 -0
- package/lib/packlets/crypto-utils/browserCryptoProvider.d.ts.map +1 -0
- package/lib/packlets/crypto-utils/browserCryptoProvider.js +259 -0
- package/lib/packlets/crypto-utils/browserCryptoProvider.js.map +1 -0
- package/lib/packlets/crypto-utils/browserHashProvider.d.ts.map +1 -0
- package/lib/packlets/crypto-utils/browserHashProvider.js.map +1 -0
- package/lib/packlets/{crypto → crypto-utils}/index.d.ts +1 -0
- package/lib/packlets/crypto-utils/index.d.ts.map +1 -0
- package/lib/packlets/{crypto → crypto-utils}/index.js +1 -0
- package/lib/packlets/crypto-utils/index.js.map +1 -0
- package/lib/packlets/file-api-types/index.d.ts.map +1 -1
- package/lib/packlets/file-api-types/index.js +27 -3
- package/lib/packlets/file-api-types/index.js.map +1 -1
- package/lib/packlets/file-tree/directoryHandleStore.d.ts +59 -0
- package/lib/packlets/file-tree/directoryHandleStore.d.ts.map +1 -0
- package/lib/packlets/file-tree/directoryHandleStore.js +128 -0
- package/lib/packlets/file-tree/directoryHandleStore.js.map +1 -0
- package/lib/packlets/file-tree/fileApiTreeAccessors.d.ts +57 -0
- package/lib/packlets/file-tree/fileApiTreeAccessors.d.ts.map +1 -1
- package/lib/packlets/file-tree/fileApiTreeAccessors.js +76 -0
- package/lib/packlets/file-tree/fileApiTreeAccessors.js.map +1 -1
- package/lib/packlets/file-tree/fileSystemAccessTreeAccessors.d.ts +136 -0
- package/lib/packlets/file-tree/fileSystemAccessTreeAccessors.d.ts.map +1 -0
- package/lib/packlets/file-tree/fileSystemAccessTreeAccessors.js +349 -0
- package/lib/packlets/file-tree/fileSystemAccessTreeAccessors.js.map +1 -0
- package/lib/packlets/file-tree/index.d.ts +3 -0
- package/lib/packlets/file-tree/index.d.ts.map +1 -1
- package/lib/packlets/file-tree/index.js +3 -0
- package/lib/packlets/file-tree/index.js.map +1 -1
- package/lib/packlets/file-tree/localStorageTreeAccessors.d.ts +129 -0
- package/lib/packlets/file-tree/localStorageTreeAccessors.d.ts.map +1 -0
- package/lib/packlets/file-tree/localStorageTreeAccessors.js +312 -0
- package/lib/packlets/file-tree/localStorageTreeAccessors.js.map +1 -0
- package/lib/test/mocks/idb-keyval.d.ts +6 -0
- package/lib/test/mocks/idb-keyval.d.ts.map +1 -0
- package/lib/test/mocks/idb-keyval.js +9 -0
- package/lib/test/mocks/idb-keyval.js.map +1 -0
- package/lib/test/unit/browserHashProvider.test.js +21 -21
- package/lib/test/unit/browserHashProvider.test.js.map +1 -1
- package/lib/test/unit/directoryHandleStore.test.d.ts +2 -0
- package/lib/test/unit/directoryHandleStore.test.d.ts.map +1 -0
- package/lib/test/unit/directoryHandleStore.test.js +192 -0
- package/lib/test/unit/directoryHandleStore.test.js.map +1 -0
- package/lib/test/unit/fileApiTypes.test.js +30 -0
- package/lib/test/unit/fileApiTypes.test.js.map +1 -1
- package/lib/test/unit/fileSystemAccessTreeAccessors.test.d.ts +2 -0
- package/lib/test/unit/fileSystemAccessTreeAccessors.test.d.ts.map +1 -0
- package/lib/test/unit/fileSystemAccessTreeAccessors.test.js +519 -0
- package/lib/test/unit/fileSystemAccessTreeAccessors.test.js.map +1 -0
- package/lib/test/unit/localStorageTreeAccessors.test.d.ts +2 -0
- package/lib/test/unit/localStorageTreeAccessors.test.d.ts.map +1 -0
- package/lib/test/unit/localStorageTreeAccessors.test.js +597 -0
- package/lib/test/unit/localStorageTreeAccessors.test.js.map +1 -0
- package/lib/test/utils/fileSystemAccessMocks.d.ts +53 -0
- package/lib/test/utils/fileSystemAccessMocks.d.ts.map +1 -0
- package/lib/test/utils/fileSystemAccessMocks.js +277 -0
- package/lib/test/utils/fileSystemAccessMocks.js.map +1 -0
- package/package.json +27 -20
- package/rush-logs/ts-web-extras.build.cache.log +3 -1
- package/rush-logs/ts-web-extras.build.log +35 -25
- package/src/index.ts +2 -2
- package/src/packlets/crypto-utils/browserCryptoProvider.ts +311 -0
- package/src/packlets/{crypto → crypto-utils}/index.ts +1 -0
- package/src/packlets/file-api-types/index.ts +24 -3
- package/src/packlets/file-tree/directoryHandleStore.ts +136 -0
- package/src/packlets/file-tree/fileApiTreeAccessors.ts +90 -0
- package/src/packlets/file-tree/fileSystemAccessTreeAccessors.ts +427 -0
- package/src/packlets/file-tree/index.ts +3 -0
- package/src/packlets/file-tree/localStorageTreeAccessors.ts +377 -0
- package/src/test/mocks/idb-keyval.ts +5 -0
- package/src/test/unit/browserHashProvider.test.ts +1 -1
- package/src/test/unit/directoryHandleStore.test.ts +251 -0
- package/src/test/unit/fileApiTypes.test.ts +36 -0
- package/src/test/unit/fileSystemAccessTreeAccessors.test.ts +732 -0
- package/src/test/unit/localStorageTreeAccessors.test.ts +746 -0
- package/src/test/utils/fileSystemAccessMocks.ts +353 -0
- package/temp/build/typescript/ts_8nwakTlr.json +1 -0
- package/temp/coverage/crypto-utils/browserCryptoProvider.ts.html +1018 -0
- package/temp/coverage/{crypto → crypto-utils}/browserHashProvider.ts.html +3 -3
- package/temp/coverage/{lcov-report/crypto → crypto-utils}/index.html +21 -6
- package/temp/coverage/file-tree/directoryHandleStore.ts.html +493 -0
- package/temp/coverage/file-tree/fileApiTreeAccessors.ts.html +276 -6
- package/temp/coverage/file-tree/fileSystemAccessTreeAccessors.ts.html +1366 -0
- package/temp/coverage/file-tree/index.html +55 -10
- package/temp/coverage/file-tree/localStorageTreeAccessors.ts.html +1216 -0
- package/temp/coverage/helpers/fileTreeHelpers.ts.html +1 -1
- package/temp/coverage/helpers/index.html +1 -1
- package/temp/coverage/index.html +15 -15
- package/temp/coverage/lcov-report/crypto-utils/browserCryptoProvider.ts.html +1018 -0
- package/temp/coverage/lcov-report/{crypto → crypto-utils}/browserHashProvider.ts.html +3 -3
- package/temp/coverage/{crypto → lcov-report/crypto-utils}/index.html +21 -6
- package/temp/coverage/lcov-report/file-tree/directoryHandleStore.ts.html +493 -0
- package/temp/coverage/lcov-report/file-tree/fileApiTreeAccessors.ts.html +276 -6
- package/temp/coverage/lcov-report/file-tree/fileSystemAccessTreeAccessors.ts.html +1366 -0
- package/temp/coverage/lcov-report/file-tree/index.html +55 -10
- package/temp/coverage/lcov-report/file-tree/localStorageTreeAccessors.ts.html +1216 -0
- package/temp/coverage/lcov-report/helpers/fileTreeHelpers.ts.html +1 -1
- package/temp/coverage/lcov-report/helpers/index.html +1 -1
- package/temp/coverage/lcov-report/index.html +15 -15
- package/temp/coverage/lcov-report/url-utils/index.html +1 -1
- package/temp/coverage/lcov-report/url-utils/urlParams.ts.html +1 -1
- package/temp/coverage/lcov.info +2128 -451
- package/temp/coverage/url-utils/index.html +1 -1
- package/temp/coverage/url-utils/urlParams.ts.html +1 -1
- package/temp/test/jest/haste-map-7492f1b44480e0cdd1f220078fb3afd8-c8dd6c3430605adeb2f1cadf4f75e791-8c9336785555d572065b28c111982ba4 +0 -0
- package/temp/test/jest/perf-cache-7492f1b44480e0cdd1f220078fb3afd8-da39a3ee5e6b4b0d3255bfef95601890 +1 -1
- package/temp/ts-web-extras.api.json +3236 -385
- package/temp/ts-web-extras.api.md +91 -1
- package/dist/packlets/crypto/browserHashProvider.js.map +0 -1
- package/dist/packlets/crypto/index.js.map +0 -1
- package/lib/packlets/crypto/browserHashProvider.d.ts.map +0 -1
- package/lib/packlets/crypto/browserHashProvider.js.map +0 -1
- package/lib/packlets/crypto/index.d.ts.map +0 -1
- package/lib/packlets/crypto/index.js.map +0 -1
- package/temp/build/typescript/ts_vnCx6LlY.json +0 -1
- /package/dist/packlets/{crypto → crypto-utils}/browserHashProvider.js +0 -0
- /package/lib/packlets/{crypto → crypto-utils}/browserHashProvider.d.ts +0 -0
- /package/lib/packlets/{crypto → crypto-utils}/browserHashProvider.js +0 -0
- /package/src/packlets/{crypto → crypto-utils}/browserHashProvider.ts +0 -0
- /package/temp/test/jest/jest-transform-cache-7492f1b44480e0cdd1f220078fb3afd8-79ef2876fae7ca75eedb2aa53dc48338/{0e/package_0eb6535f5987849d93ea51ef33a14cf6 → 8d/package_8dcbedef69e4299f0f51fcda8f4f1c8e} +0 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@fgv/ts-web-extras](./ts-web-extras.md) > [FileApiTreeAccessors](./ts-web-extras.fileapitreeaccessors.md) > [createFromLocalStorage](./ts-web-extras.fileapitreeaccessors.createfromlocalstorage.md)
|
|
4
|
+
|
|
5
|
+
## FileApiTreeAccessors.createFromLocalStorage() method
|
|
6
|
+
|
|
7
|
+
Create a persistent FileTree from browser localStorage. Changes to files can be synced back to localStorage.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
static createFromLocalStorage<TCT extends string = string>(params: ILocalStorageTreeParams<TCT>): Result<FileTree.FileTree<TCT>>;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
params
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
[ILocalStorageTreeParams](./ts-web-extras.ilocalstoragetreeparams.md)<!-- --><TCT>
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
Configuration including path-to-key mappings and optional autoSync
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</td></tr>
|
|
49
|
+
</tbody></table>
|
|
50
|
+
|
|
51
|
+
**Returns:**
|
|
52
|
+
|
|
53
|
+
Result<FileTree.FileTree<TCT>>
|
|
54
|
+
|
|
55
|
+
Result containing a FileTree with persistence capability
|
|
56
|
+
|
|
57
|
+
## Remarks
|
|
58
|
+
|
|
59
|
+
- Works in all browsers with localStorage support - Maps directory paths to localStorage keys - Each key stores multiple collections as JSON - Files are automatically discovered from storage
|
|
60
|
+
|
|
61
|
+
## Example
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
const tree = FileApiTreeAccessors.createFromLocalStorage({
|
|
66
|
+
pathToKeyMap: {
|
|
67
|
+
'/data/ingredients': 'myapp:ingredients:v1',
|
|
68
|
+
'/data/fillings': 'myapp:fillings:v1'
|
|
69
|
+
},
|
|
70
|
+
mutable: true,
|
|
71
|
+
autoSync: false
|
|
72
|
+
});
|
|
73
|
+
```
|
|
74
|
+
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@fgv/ts-web-extras](./ts-web-extras.md) > [FileApiTreeAccessors](./ts-web-extras.fileapitreeaccessors.md) > [createPersistent](./ts-web-extras.fileapitreeaccessors.createpersistent.md)
|
|
4
|
+
|
|
5
|
+
## FileApiTreeAccessors.createPersistent() method
|
|
6
|
+
|
|
7
|
+
Create a persistent FileTree from a File System Access API directory handle. Changes to files can be synced back to disk.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
static createPersistent<TCT extends string = string>(dirHandle: FileSystemDirectoryHandle, params?: IFileSystemAccessTreeParams<TCT>): Promise<Result<FileTree.FileTree<TCT>>>;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
dirHandle
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
[FileSystemDirectoryHandle](./ts-web-extras.filesystemdirectoryhandle_2.md)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
FileSystemDirectoryHandle to load files from
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</td></tr>
|
|
49
|
+
<tr><td>
|
|
50
|
+
|
|
51
|
+
params
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
</td><td>
|
|
55
|
+
|
|
56
|
+
[IFileSystemAccessTreeParams](./ts-web-extras.ifilesystemaccesstreeparams.md)<!-- --><TCT>
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
</td><td>
|
|
60
|
+
|
|
61
|
+
_(Optional)_ Optional parameters including autoSync and permission settings
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
</td></tr>
|
|
65
|
+
</tbody></table>
|
|
66
|
+
|
|
67
|
+
**Returns:**
|
|
68
|
+
|
|
69
|
+
Promise<Result<FileTree.FileTree<TCT>>>
|
|
70
|
+
|
|
71
|
+
Promise resolving to a FileTree with persistence capability
|
|
72
|
+
|
|
73
|
+
## Remarks
|
|
74
|
+
|
|
75
|
+
- Only works in browsers supporting File System Access API (Chrome, Edge, Opera) - Requires 'readwrite' permission on the directory handle - Falls back to read-only mode if permissions unavailable (unless requireWritePermission is true)
|
|
76
|
+
|
|
@@ -45,6 +45,38 @@ Description
|
|
|
45
45
|
Create FileTree from various file sources using TreeInitializer array.
|
|
46
46
|
|
|
47
47
|
|
|
48
|
+
</td></tr>
|
|
49
|
+
<tr><td>
|
|
50
|
+
|
|
51
|
+
[createFromLocalStorage(params)](./ts-web-extras.fileapitreeaccessors.createfromlocalstorage.md)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
</td><td>
|
|
55
|
+
|
|
56
|
+
`static`
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
</td><td>
|
|
60
|
+
|
|
61
|
+
Create a persistent FileTree from browser localStorage. Changes to files can be synced back to localStorage.
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
</td></tr>
|
|
65
|
+
<tr><td>
|
|
66
|
+
|
|
67
|
+
[createPersistent(dirHandle, params)](./ts-web-extras.fileapitreeaccessors.createpersistent.md)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
</td><td>
|
|
71
|
+
|
|
72
|
+
`static`
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
</td><td>
|
|
76
|
+
|
|
77
|
+
Create a persistent FileTree from a File System Access API directory handle. Changes to files can be synced back to disk.
|
|
78
|
+
|
|
79
|
+
|
|
48
80
|
</td></tr>
|
|
49
81
|
<tr><td>
|
|
50
82
|
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@fgv/ts-web-extras](./ts-web-extras.md) > [FileSystemAccessTreeAccessors](./ts-web-extras.filesystemaccesstreeaccessors.md) > [(constructor)](./ts-web-extras.filesystemaccesstreeaccessors._constructor_.md)
|
|
4
|
+
|
|
5
|
+
## FileSystemAccessTreeAccessors.(constructor)
|
|
6
|
+
|
|
7
|
+
Protected constructor for FileSystemAccessTreeAccessors.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
protected constructor(files: FileTree.IInMemoryFile<TCT>[], rootDir: FileSystemDirectoryHandle, handles: Map<string, FileSystemFileHandle>, params: IFileSystemAccessTreeParams<TCT> | undefined, hasWritePermission: boolean);
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
files
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
FileTree.IInMemoryFile<TCT>\[\]
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
An array of in-memory files to include in the tree.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</td></tr>
|
|
49
|
+
<tr><td>
|
|
50
|
+
|
|
51
|
+
rootDir
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
</td><td>
|
|
55
|
+
|
|
56
|
+
[FileSystemDirectoryHandle](./ts-web-extras.filesystemdirectoryhandle_2.md)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
</td><td>
|
|
60
|
+
|
|
61
|
+
The root directory handle.
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
</td></tr>
|
|
65
|
+
<tr><td>
|
|
66
|
+
|
|
67
|
+
handles
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
</td><td>
|
|
71
|
+
|
|
72
|
+
Map<string, [FileSystemFileHandle](./ts-web-extras.filesystemfilehandle_2.md)<!-- -->>
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
</td><td>
|
|
76
|
+
|
|
77
|
+
Map of file paths to their handles.
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
</td></tr>
|
|
81
|
+
<tr><td>
|
|
82
|
+
|
|
83
|
+
params
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
</td><td>
|
|
87
|
+
|
|
88
|
+
[IFileSystemAccessTreeParams](./ts-web-extras.ifilesystemaccesstreeparams.md)<!-- --><TCT> \| undefined
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
</td><td>
|
|
92
|
+
|
|
93
|
+
Optional params for the tree.
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
</td></tr>
|
|
97
|
+
<tr><td>
|
|
98
|
+
|
|
99
|
+
hasWritePermission
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
</td><td>
|
|
103
|
+
|
|
104
|
+
boolean
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
</td><td>
|
|
108
|
+
|
|
109
|
+
Whether write permission was granted.
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
</td></tr>
|
|
113
|
+
</tbody></table>
|
|
114
|
+
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@fgv/ts-web-extras](./ts-web-extras.md) > [FileSystemAccessTreeAccessors](./ts-web-extras.filesystemaccesstreeaccessors.md) > [fileIsMutable](./ts-web-extras.filesystemaccesstreeaccessors.fileismutable.md)
|
|
4
|
+
|
|
5
|
+
## FileSystemAccessTreeAccessors.fileIsMutable() method
|
|
6
|
+
|
|
7
|
+
Implements `FileTree.IMutableFileTreeAccessors.fileIsMutable`
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
fileIsMutable(path: string): DetailedResult<boolean, FileTree.SaveDetail>;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
path
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
string
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
</td></tr>
|
|
47
|
+
</tbody></table>
|
|
48
|
+
|
|
49
|
+
**Returns:**
|
|
50
|
+
|
|
51
|
+
DetailedResult<boolean, FileTree.SaveDetail>
|
|
52
|
+
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@fgv/ts-web-extras](./ts-web-extras.md) > [FileSystemAccessTreeAccessors](./ts-web-extras.filesystemaccesstreeaccessors.md) > [fromDirectoryHandle](./ts-web-extras.filesystemaccesstreeaccessors.fromdirectoryhandle.md)
|
|
4
|
+
|
|
5
|
+
## FileSystemAccessTreeAccessors.fromDirectoryHandle() method
|
|
6
|
+
|
|
7
|
+
Creates a new FileSystemAccessTreeAccessors instance from a directory handle.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
static fromDirectoryHandle<TCT extends string = string>(dirHandle: FileSystemDirectoryHandle, params?: IFileSystemAccessTreeParams<TCT>): Promise<Result<FileSystemAccessTreeAccessors<TCT>>>;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
dirHandle
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
[FileSystemDirectoryHandle](./ts-web-extras.filesystemdirectoryhandle_2.md)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
The FileSystemDirectoryHandle to load files from.
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
</td></tr>
|
|
49
|
+
<tr><td>
|
|
50
|
+
|
|
51
|
+
params
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
</td><td>
|
|
55
|
+
|
|
56
|
+
[IFileSystemAccessTreeParams](./ts-web-extras.ifilesystemaccesstreeparams.md)<!-- --><TCT>
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
</td><td>
|
|
60
|
+
|
|
61
|
+
_(Optional)_ Optional parameters including autoSync and permission settings.
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
</td></tr>
|
|
65
|
+
</tbody></table>
|
|
66
|
+
|
|
67
|
+
**Returns:**
|
|
68
|
+
|
|
69
|
+
Promise<Result<[FileSystemAccessTreeAccessors](./ts-web-extras.filesystemaccesstreeaccessors.md)<!-- --><TCT>>>
|
|
70
|
+
|
|
71
|
+
Promise resolving to a FileSystemAccessTreeAccessors instance.
|
|
72
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@fgv/ts-web-extras](./ts-web-extras.md) > [FileSystemAccessTreeAccessors](./ts-web-extras.filesystemaccesstreeaccessors.md) > [getDirtyPaths](./ts-web-extras.filesystemaccesstreeaccessors.getdirtypaths.md)
|
|
4
|
+
|
|
5
|
+
## FileSystemAccessTreeAccessors.getDirtyPaths() method
|
|
6
|
+
|
|
7
|
+
Implements `FileTree.IPersistentFileTreeAccessors.getDirtyPaths`
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
getDirtyPaths(): string[];
|
|
13
|
+
```
|
|
14
|
+
**Returns:**
|
|
15
|
+
|
|
16
|
+
string\[\]
|
|
17
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@fgv/ts-web-extras](./ts-web-extras.md) > [FileSystemAccessTreeAccessors](./ts-web-extras.filesystemaccesstreeaccessors.md) > [isDirty](./ts-web-extras.filesystemaccesstreeaccessors.isdirty.md)
|
|
4
|
+
|
|
5
|
+
## FileSystemAccessTreeAccessors.isDirty() method
|
|
6
|
+
|
|
7
|
+
Implements `FileTree.IPersistentFileTreeAccessors.isDirty`
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
isDirty(): boolean;
|
|
13
|
+
```
|
|
14
|
+
**Returns:**
|
|
15
|
+
|
|
16
|
+
boolean
|
|
17
|
+
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@fgv/ts-web-extras](./ts-web-extras.md) > [FileSystemAccessTreeAccessors](./ts-web-extras.filesystemaccesstreeaccessors.md)
|
|
4
|
+
|
|
5
|
+
## FileSystemAccessTreeAccessors class
|
|
6
|
+
|
|
7
|
+
Implementation of `FileTree.IPersistentFileTreeAccessors` that uses the File System Access API to provide persistent file editing in browsers.
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
export declare class FileSystemAccessTreeAccessors<TCT extends string = string> extends FileTree.InMemoryTreeAccessors<TCT> implements FileTree.IPersistentFileTreeAccessors<TCT>
|
|
13
|
+
```
|
|
14
|
+
**Extends:** FileTree.InMemoryTreeAccessors<TCT>
|
|
15
|
+
|
|
16
|
+
**Implements:** FileTree.IPersistentFileTreeAccessors<TCT>
|
|
17
|
+
|
|
18
|
+
## Constructors
|
|
19
|
+
|
|
20
|
+
<table><thead><tr><th>
|
|
21
|
+
|
|
22
|
+
Constructor
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
</th><th>
|
|
26
|
+
|
|
27
|
+
Modifiers
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
</th><th>
|
|
31
|
+
|
|
32
|
+
Description
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
</th></tr></thead>
|
|
36
|
+
<tbody><tr><td>
|
|
37
|
+
|
|
38
|
+
[(constructor)(files, rootDir, handles, params, hasWritePermission)](./ts-web-extras.filesystemaccesstreeaccessors._constructor_.md)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
</td><td>
|
|
42
|
+
|
|
43
|
+
`protected`
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
</td><td>
|
|
47
|
+
|
|
48
|
+
Protected constructor for FileSystemAccessTreeAccessors.
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
</td></tr>
|
|
52
|
+
</tbody></table>
|
|
53
|
+
|
|
54
|
+
## Methods
|
|
55
|
+
|
|
56
|
+
<table><thead><tr><th>
|
|
57
|
+
|
|
58
|
+
Method
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
</th><th>
|
|
62
|
+
|
|
63
|
+
Modifiers
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
</th><th>
|
|
67
|
+
|
|
68
|
+
Description
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
</th></tr></thead>
|
|
72
|
+
<tbody><tr><td>
|
|
73
|
+
|
|
74
|
+
[fileIsMutable(path)](./ts-web-extras.filesystemaccesstreeaccessors.fileismutable.md)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
</td><td>
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
</td><td>
|
|
81
|
+
|
|
82
|
+
Implements `FileTree.IMutableFileTreeAccessors.fileIsMutable`
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
</td></tr>
|
|
86
|
+
<tr><td>
|
|
87
|
+
|
|
88
|
+
[fromDirectoryHandle(dirHandle, params)](./ts-web-extras.filesystemaccesstreeaccessors.fromdirectoryhandle.md)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
</td><td>
|
|
92
|
+
|
|
93
|
+
`static`
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
</td><td>
|
|
97
|
+
|
|
98
|
+
Creates a new FileSystemAccessTreeAccessors instance from a directory handle.
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
</td></tr>
|
|
102
|
+
<tr><td>
|
|
103
|
+
|
|
104
|
+
[getDirtyPaths()](./ts-web-extras.filesystemaccesstreeaccessors.getdirtypaths.md)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
</td><td>
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
</td><td>
|
|
111
|
+
|
|
112
|
+
Implements `FileTree.IPersistentFileTreeAccessors.getDirtyPaths`
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
</td></tr>
|
|
116
|
+
<tr><td>
|
|
117
|
+
|
|
118
|
+
[isDirty()](./ts-web-extras.filesystemaccesstreeaccessors.isdirty.md)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
</td><td>
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
</td><td>
|
|
125
|
+
|
|
126
|
+
Implements `FileTree.IPersistentFileTreeAccessors.isDirty`
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
</td></tr>
|
|
130
|
+
<tr><td>
|
|
131
|
+
|
|
132
|
+
[saveFileContents(path, contents)](./ts-web-extras.filesystemaccesstreeaccessors.savefilecontents.md)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
</td><td>
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
</td><td>
|
|
139
|
+
|
|
140
|
+
Implements `FileTree.IMutableFileTreeAccessors.saveFileContents`
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
</td></tr>
|
|
144
|
+
<tr><td>
|
|
145
|
+
|
|
146
|
+
[syncToDisk()](./ts-web-extras.filesystemaccesstreeaccessors.synctodisk.md)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
</td><td>
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
</td><td>
|
|
153
|
+
|
|
154
|
+
Implements `FileTree.IPersistentFileTreeAccessors.syncToDisk`
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
</td></tr>
|
|
158
|
+
</tbody></table>
|
|
159
|
+
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@fgv/ts-web-extras](./ts-web-extras.md) > [FileSystemAccessTreeAccessors](./ts-web-extras.filesystemaccesstreeaccessors.md) > [saveFileContents](./ts-web-extras.filesystemaccesstreeaccessors.savefilecontents.md)
|
|
4
|
+
|
|
5
|
+
## FileSystemAccessTreeAccessors.saveFileContents() method
|
|
6
|
+
|
|
7
|
+
Implements `FileTree.IMutableFileTreeAccessors.saveFileContents`
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
saveFileContents(path: string, contents: string): Result<string>;
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Parameters
|
|
16
|
+
|
|
17
|
+
<table><thead><tr><th>
|
|
18
|
+
|
|
19
|
+
Parameter
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
</th><th>
|
|
23
|
+
|
|
24
|
+
Type
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
</th><th>
|
|
28
|
+
|
|
29
|
+
Description
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
</th></tr></thead>
|
|
33
|
+
<tbody><tr><td>
|
|
34
|
+
|
|
35
|
+
path
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
</td><td>
|
|
39
|
+
|
|
40
|
+
string
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
</td><td>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
</td></tr>
|
|
47
|
+
<tr><td>
|
|
48
|
+
|
|
49
|
+
contents
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
</td><td>
|
|
53
|
+
|
|
54
|
+
string
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
</td><td>
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
</td></tr>
|
|
61
|
+
</tbody></table>
|
|
62
|
+
|
|
63
|
+
**Returns:**
|
|
64
|
+
|
|
65
|
+
Result<string>
|
|
66
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@fgv/ts-web-extras](./ts-web-extras.md) > [FileSystemAccessTreeAccessors](./ts-web-extras.filesystemaccesstreeaccessors.md) > [syncToDisk](./ts-web-extras.filesystemaccesstreeaccessors.synctodisk.md)
|
|
4
|
+
|
|
5
|
+
## FileSystemAccessTreeAccessors.syncToDisk() method
|
|
6
|
+
|
|
7
|
+
Implements `FileTree.IPersistentFileTreeAccessors.syncToDisk`
|
|
8
|
+
|
|
9
|
+
**Signature:**
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
syncToDisk(): Promise<Result<void>>;
|
|
13
|
+
```
|
|
14
|
+
**Returns:**
|
|
15
|
+
|
|
16
|
+
Promise<Result<void>>
|
|
17
|
+
|