@themartiancompany/opfs 1.8.11
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/COPYING +674 -0
- package/README.cn.md +301 -0
- package/README.md +241 -0
- package/dist/main.cjs +1840 -0
- package/dist/main.cjs.map +1 -0
- package/dist/main.mjs +1751 -0
- package/dist/main.mjs.map +1 -0
- package/dist/types.d.ts +920 -0
- package/dist/types.d.ts.map +1 -0
- package/docs/README.md +115 -0
- package/docs/classes/SyncMessenger.md +42 -0
- package/docs/functions/appendFile.md +29 -0
- package/docs/functions/appendFileSync.md +26 -0
- package/docs/functions/assertAbsolutePath.md +29 -0
- package/docs/functions/assertFileUrl.md +29 -0
- package/docs/functions/connectSyncAgent.md +25 -0
- package/docs/functions/copy.md +35 -0
- package/docs/functions/copySync.md +30 -0
- package/docs/functions/createFile.md +27 -0
- package/docs/functions/createFileSync.md +25 -0
- package/docs/functions/deleteTemp.md +23 -0
- package/docs/functions/deleteTempSync.md +19 -0
- package/docs/functions/downloadFile.md +58 -0
- package/docs/functions/emptyDir.md +28 -0
- package/docs/functions/emptyDirSync.md +25 -0
- package/docs/functions/exists.md +29 -0
- package/docs/functions/existsSync.md +26 -0
- package/docs/functions/generateTempPath.md +27 -0
- package/docs/functions/getFileDataByHandle.md +27 -0
- package/docs/functions/getSyncMessenger.md +22 -0
- package/docs/functions/isDirectoryHandle.md +27 -0
- package/docs/functions/isFileHandle.md +27 -0
- package/docs/functions/isFileHandleLike.md +27 -0
- package/docs/functions/isOPFSSupported.md +21 -0
- package/docs/functions/isTempPath.md +27 -0
- package/docs/functions/mkTemp.md +28 -0
- package/docs/functions/mkTempSync.md +25 -0
- package/docs/functions/mkdir.md +27 -0
- package/docs/functions/mkdirSync.md +25 -0
- package/docs/functions/move.md +34 -0
- package/docs/functions/moveSync.md +30 -0
- package/docs/functions/pruneTemp.md +28 -0
- package/docs/functions/pruneTempSync.md +25 -0
- package/docs/functions/readBlobFile.md +28 -0
- package/docs/functions/readBlobFileSync.md +25 -0
- package/docs/functions/readDir.md +28 -0
- package/docs/functions/readDirSync.md +26 -0
- package/docs/functions/readFile.md +132 -0
- package/docs/functions/readFileSync.md +70 -0
- package/docs/functions/readJsonFile.md +35 -0
- package/docs/functions/readJsonFileSync.md +31 -0
- package/docs/functions/readTextFile.md +28 -0
- package/docs/functions/readTextFileSync.md +25 -0
- package/docs/functions/remove.md +27 -0
- package/docs/functions/removeSync.md +25 -0
- package/docs/functions/setSyncMessenger.md +26 -0
- package/docs/functions/startSyncAgent.md +21 -0
- package/docs/functions/stat.md +27 -0
- package/docs/functions/statSync.md +25 -0
- package/docs/functions/toFileSystemHandleLike.md +27 -0
- package/docs/functions/unzip.md +32 -0
- package/docs/functions/unzipFromUrl.md +36 -0
- package/docs/functions/unzipSync.md +26 -0
- package/docs/functions/uploadFile.md +33 -0
- package/docs/functions/writeFile.md +32 -0
- package/docs/functions/writeFileSync.md +30 -0
- package/docs/functions/zip.md +65 -0
- package/docs/functions/zipFromUrl.md +63 -0
- package/docs/functions/zipSync.md +55 -0
- package/docs/interfaces/CopyOptions.md +17 -0
- package/docs/interfaces/DownloadFileTempResponse.md +18 -0
- package/docs/interfaces/ErrorLike.md +18 -0
- package/docs/interfaces/ExistsOptions.md +18 -0
- package/docs/interfaces/FileLike.md +21 -0
- package/docs/interfaces/FileSystemFileHandleLike.md +25 -0
- package/docs/interfaces/FileSystemHandleLike.md +22 -0
- package/docs/interfaces/MoveOptions.md +17 -0
- package/docs/interfaces/ReadDirEntry.md +18 -0
- package/docs/interfaces/ReadDirEntrySync.md +18 -0
- package/docs/interfaces/ReadDirOptions.md +17 -0
- package/docs/interfaces/ReadOptions.md +17 -0
- package/docs/interfaces/SyncAgentOptions.md +19 -0
- package/docs/interfaces/TempOptions.md +19 -0
- package/docs/interfaces/UploadRequestInit.md +21 -0
- package/docs/interfaces/WriteOptions.md +19 -0
- package/docs/interfaces/ZipOptions.md +17 -0
- package/docs/type-aliases/FileEncoding.md +15 -0
- package/docs/type-aliases/FsRequestInit.md +15 -0
- package/docs/type-aliases/ReadFileContent.md +15 -0
- package/docs/type-aliases/WriteFileContent.md +15 -0
- package/docs/type-aliases/WriteSyncFileContent.md +16 -0
- package/docs/variables/CURRENT_DIR.md +15 -0
- package/docs/variables/NOT_FOUND_ERROR.md +18 -0
- package/docs/variables/ROOT_DIR.md +15 -0
- package/docs/variables/TMP_DIR.md +15 -0
- package/package.json +141 -0
- package/src/fs/assertions.ts +63 -0
- package/src/fs/constants.ts +63 -0
- package/src/fs/defines.ts +352 -0
- package/src/fs/helpers.ts +338 -0
- package/src/fs/opfs_core.ts +413 -0
- package/src/fs/opfs_download.ts +174 -0
- package/src/fs/opfs_ext.ts +504 -0
- package/src/fs/opfs_tmp.ts +131 -0
- package/src/fs/opfs_unzip.ts +168 -0
- package/src/fs/opfs_upload.ts +126 -0
- package/src/fs/opfs_zip.ts +314 -0
- package/src/fs/support.ts +36 -0
- package/src/fs/utils.ts +176 -0
- package/src/mod.ts +41 -0
- package/src/worker/helpers.ts +168 -0
- package/src/worker/opfs_worker.ts +298 -0
- package/src/worker/opfs_worker_adapter.ts +666 -0
- package/src/worker/shared.ts +400 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / createFile
|
|
6
|
+
|
|
7
|
+
# Function: createFile()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function createFile(filePath): AsyncVoidIOResult
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: fs/opfs\_core.ts:56
|
|
14
|
+
|
|
15
|
+
Creates a new file at the specified path same as `touch`.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Type | Description |
|
|
20
|
+
| ------ | ------ | ------ |
|
|
21
|
+
| `filePath` | `string` | The path of the file to create. |
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`AsyncVoidIOResult`
|
|
26
|
+
|
|
27
|
+
A promise that resolves to an `AsyncIOResult` indicating whether the file was successfully created.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / createFileSync
|
|
6
|
+
|
|
7
|
+
# Function: createFileSync()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function createFileSync(filePath): VoidIOResult
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: worker/opfs\_worker\_adapter.ts:230
|
|
14
|
+
|
|
15
|
+
Sync version of `createFile`.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Type |
|
|
20
|
+
| ------ | ------ |
|
|
21
|
+
| `filePath` | `string` |
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`VoidIOResult`
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / deleteTemp
|
|
6
|
+
|
|
7
|
+
# Function: deleteTemp()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function deleteTemp(): AsyncVoidIOResult
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: fs/opfs\_tmp.ts:81
|
|
14
|
+
|
|
15
|
+
Delete the temporary directory and all its contents.
|
|
16
|
+
|
|
17
|
+
## Returns
|
|
18
|
+
|
|
19
|
+
`AsyncVoidIOResult`
|
|
20
|
+
|
|
21
|
+
A promise that resolves to an `AsyncVoidIOResult`
|
|
22
|
+
indicating whether the temporary directory was
|
|
23
|
+
successfully deleted.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / deleteTempSync
|
|
6
|
+
|
|
7
|
+
# Function: deleteTempSync()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function deleteTempSync(): VoidIOResult
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: worker/opfs\_worker\_adapter.ts:508
|
|
14
|
+
|
|
15
|
+
Sync version of `deleteTemp`.
|
|
16
|
+
|
|
17
|
+
## Returns
|
|
18
|
+
|
|
19
|
+
`VoidIOResult`
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / downloadFile
|
|
6
|
+
|
|
7
|
+
# Function: downloadFile()
|
|
8
|
+
|
|
9
|
+
## Call Signature
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
function downloadFile(fileUrl, requestInit?): FetchTask<DownloadFileTempResponse>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Defined in: fs/opfs\_download.ts:50
|
|
16
|
+
|
|
17
|
+
Downloads a file from a URL and saves it to a temporary file.
|
|
18
|
+
The returned response will contain the temporary file path.
|
|
19
|
+
|
|
20
|
+
### Parameters
|
|
21
|
+
|
|
22
|
+
| Parameter | Type | Description |
|
|
23
|
+
| ------ | ------ | ------ |
|
|
24
|
+
| `fileUrl` | `string` | The URL of the file to download. |
|
|
25
|
+
| `requestInit`? | [`FsRequestInit`](../type-aliases/FsRequestInit.md) | Optional request initialization parameters. |
|
|
26
|
+
|
|
27
|
+
### Returns
|
|
28
|
+
|
|
29
|
+
`FetchTask`\<[`DownloadFileTempResponse`](../interfaces/DownloadFileTempResponse.md)\>
|
|
30
|
+
|
|
31
|
+
A task that can be aborted and contains the result of the download.
|
|
32
|
+
|
|
33
|
+
## Call Signature
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
function downloadFile(
|
|
37
|
+
fileUrl,
|
|
38
|
+
filePath,
|
|
39
|
+
requestInit?): FetchTask<Response>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Defined in: fs/opfs\_download.ts:66
|
|
43
|
+
|
|
44
|
+
Downloads a file from a URL and saves it to the specified path.
|
|
45
|
+
|
|
46
|
+
### Parameters
|
|
47
|
+
|
|
48
|
+
| Parameter | Type | Description |
|
|
49
|
+
| ------ | ------ | ------ |
|
|
50
|
+
| `fileUrl` | `string` | The URL of the file to download. |
|
|
51
|
+
| `filePath` | `string` | The path where the downloaded file will be saved. |
|
|
52
|
+
| `requestInit`? | [`FsRequestInit`](../type-aliases/FsRequestInit.md) | Optional request initialization parameters. |
|
|
53
|
+
|
|
54
|
+
### Returns
|
|
55
|
+
|
|
56
|
+
`FetchTask`\<`Response`\>
|
|
57
|
+
|
|
58
|
+
A task that can be aborted and contains the result of the download.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / emptyDir
|
|
6
|
+
|
|
7
|
+
# Function: emptyDir()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function emptyDir(dirPath): AsyncVoidIOResult
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: fs/opfs\_ext.ts:315
|
|
14
|
+
|
|
15
|
+
Empties the contents of a directory at the specified path.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Type | Description |
|
|
20
|
+
| ------ | ------ | ------ |
|
|
21
|
+
| `dirPath` | `string` | The path of the directory to empty. |
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`AsyncVoidIOResult`
|
|
26
|
+
|
|
27
|
+
A promise that resolves to an `AsyncIOResult`
|
|
28
|
+
indicating whether the directory was successfully emptied.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / emptyDirSync
|
|
6
|
+
|
|
7
|
+
# Function: emptyDirSync()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function emptyDirSync(dirPath): VoidIOResult
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: worker/opfs\_worker\_adapter.ts:477
|
|
14
|
+
|
|
15
|
+
Sync version of `emptyDir`.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Type |
|
|
20
|
+
| ------ | ------ |
|
|
21
|
+
| `dirPath` | `string` |
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`VoidIOResult`
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / exists
|
|
6
|
+
|
|
7
|
+
# Function: exists()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function exists(path, options?): AsyncIOResult<boolean>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: fs/opfs\_ext.ts:357
|
|
14
|
+
|
|
15
|
+
Checks whether a file or directory exists at the specified path.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Type | Description |
|
|
20
|
+
| ------ | ------ | ------ |
|
|
21
|
+
| `path` | `string` | The path of the file or directory to check for existence. |
|
|
22
|
+
| `options`? | [`ExistsOptions`](../interfaces/ExistsOptions.md) | Optional existence options. |
|
|
23
|
+
|
|
24
|
+
## Returns
|
|
25
|
+
|
|
26
|
+
`AsyncIOResult`\<`boolean`\>
|
|
27
|
+
|
|
28
|
+
A promise that resolves to an `AsyncIOResult`
|
|
29
|
+
indicating whether the file or directory exists.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / existsSync
|
|
6
|
+
|
|
7
|
+
# Function: existsSync()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function existsSync(path, options?): IOResult<boolean>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: worker/opfs\_worker\_adapter.ts:491
|
|
14
|
+
|
|
15
|
+
Sync version of `exists`.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Type |
|
|
20
|
+
| ------ | ------ |
|
|
21
|
+
| `path` | `string` |
|
|
22
|
+
| `options`? | [`ExistsOptions`](../interfaces/ExistsOptions.md) |
|
|
23
|
+
|
|
24
|
+
## Returns
|
|
25
|
+
|
|
26
|
+
`IOResult`\<`boolean`\>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / generateTempPath
|
|
6
|
+
|
|
7
|
+
# Function: generateTempPath()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function generateTempPath(options?): string
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: fs/utils.ts:41
|
|
14
|
+
|
|
15
|
+
Generate a temporary path but not create it.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Type | Description |
|
|
20
|
+
| ------ | ------ | ------ |
|
|
21
|
+
| `options`? | [`TempOptions`](../interfaces/TempOptions.md) | Options and flags. |
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`string`
|
|
26
|
+
|
|
27
|
+
The temporary path.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / getFileDataByHandle
|
|
6
|
+
|
|
7
|
+
# Function: getFileDataByHandle()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function getFileDataByHandle(handle): Promise<Uint8Array<ArrayBufferLike>>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: fs/utils.ts:164
|
|
14
|
+
|
|
15
|
+
Gets the data of a file handle.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Type | Description |
|
|
20
|
+
| ------ | ------ | ------ |
|
|
21
|
+
| `handle` | `FileSystemFileHandle` | The file handle. |
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`Promise`\<`Uint8Array`\<`ArrayBufferLike`\>\>
|
|
26
|
+
|
|
27
|
+
A promise that resolves to the data of the file.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / getSyncMessenger
|
|
6
|
+
|
|
7
|
+
# Function: getSyncMessenger()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function getSyncMessenger(): SyncMessenger
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: worker/opfs\_worker\_adapter.ts:140
|
|
14
|
+
|
|
15
|
+
Get messenger instance.
|
|
16
|
+
Use `setSyncMessenger` to pass the messenger to other environments for sharing.
|
|
17
|
+
|
|
18
|
+
## Returns
|
|
19
|
+
|
|
20
|
+
[`SyncMessenger`](../classes/SyncMessenger.md)
|
|
21
|
+
|
|
22
|
+
SyncMessenger instance.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / isDirectoryHandle
|
|
6
|
+
|
|
7
|
+
# Function: isDirectoryHandle()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function isDirectoryHandle(handle): handle is FileSystemDirectoryHandle
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: fs/utils.ts:138
|
|
14
|
+
|
|
15
|
+
Whether the handle is a directory.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Type | Description |
|
|
20
|
+
| ------ | ------ | ------ |
|
|
21
|
+
| `handle` | `FileSystemHandle` | The handle which is a FileSystemHandle. |
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`handle is FileSystemDirectoryHandle`
|
|
26
|
+
|
|
27
|
+
`true` if the handle is a directory, otherwise `false`.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / isFileHandle
|
|
6
|
+
|
|
7
|
+
# Function: isFileHandle()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function isFileHandle(handle): handle is FileSystemFileHandle
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: fs/utils.ts:125
|
|
14
|
+
|
|
15
|
+
Whether the handle is a file.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Type | Description |
|
|
20
|
+
| ------ | ------ | ------ |
|
|
21
|
+
| `handle` | `FileSystemHandle` | The handle which is a FileSystemHandle. |
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`handle is FileSystemFileHandle`
|
|
26
|
+
|
|
27
|
+
`true` if the handle is a file, otherwise `false`.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / isFileHandleLike
|
|
6
|
+
|
|
7
|
+
# Function: isFileHandleLike()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function isFileHandleLike(handle): handle is FileSystemFileHandleLike
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: fs/utils.ts:151
|
|
14
|
+
|
|
15
|
+
Whether the handle is a file-like.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Type | Description |
|
|
20
|
+
| ------ | ------ | ------ |
|
|
21
|
+
| `handle` | [`FileSystemHandleLike`](../interfaces/FileSystemHandleLike.md) | The handle which is a FileSystemHandleLike. |
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`handle is FileSystemFileHandleLike`
|
|
26
|
+
|
|
27
|
+
`true` if the handle is a file, otherwise `false`.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / isOPFSSupported
|
|
6
|
+
|
|
7
|
+
# Function: isOPFSSupported()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function isOPFSSupported(): boolean
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: fs/support.ts:33
|
|
14
|
+
|
|
15
|
+
Checks if the Origin Private File System (OPFS) is supported in the current environment.
|
|
16
|
+
|
|
17
|
+
## Returns
|
|
18
|
+
|
|
19
|
+
`boolean`
|
|
20
|
+
|
|
21
|
+
A boolean indicating whether OPFS is supported.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / isTempPath
|
|
6
|
+
|
|
7
|
+
# Function: isTempPath()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function isTempPath(path): boolean
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: fs/utils.ts:67
|
|
14
|
+
|
|
15
|
+
Check whether the path is a temporary path.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Type | Description |
|
|
20
|
+
| ------ | ------ | ------ |
|
|
21
|
+
| `path` | `string` | The path to check. |
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`boolean`
|
|
26
|
+
|
|
27
|
+
`true` if the path is a temporary path otherwise `false`.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / mkTemp
|
|
6
|
+
|
|
7
|
+
# Function: mkTemp()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function mkTemp(options?): AsyncIOResult<string>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: fs/opfs\_tmp.ts:51
|
|
14
|
+
|
|
15
|
+
Create a temporary file or directory.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Type | Description |
|
|
20
|
+
| ------ | ------ | ------ |
|
|
21
|
+
| `options`? | [`TempOptions`](../interfaces/TempOptions.md) | Options and flags. |
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`AsyncIOResult`\<`string`\>
|
|
26
|
+
|
|
27
|
+
A promise that resolves the result of
|
|
28
|
+
the temporary file or directory path.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / mkTempSync
|
|
6
|
+
|
|
7
|
+
# Function: mkTempSync()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function mkTempSync(options?): IOResult<string>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: worker/opfs\_worker\_adapter.ts:519
|
|
14
|
+
|
|
15
|
+
Sync version of `mkTemp`.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Type |
|
|
20
|
+
| ------ | ------ |
|
|
21
|
+
| `options`? | [`TempOptions`](../interfaces/TempOptions.md) |
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`IOResult`\<`string`\>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / mkdir
|
|
6
|
+
|
|
7
|
+
# Function: mkdir()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function mkdir(dirPath): AsyncVoidIOResult
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: fs/opfs\_core.ts:79
|
|
14
|
+
|
|
15
|
+
Creates a new directory at the specified path same as `mkdir -p`.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Type | Description |
|
|
20
|
+
| ------ | ------ | ------ |
|
|
21
|
+
| `dirPath` | `string` | The path where the new directory will be created. |
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`AsyncVoidIOResult`
|
|
26
|
+
|
|
27
|
+
A promise that resolves to an `AsyncIOResult` indicating whether the directory was successfully created.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / mkdirSync
|
|
6
|
+
|
|
7
|
+
# Function: mkdirSync()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function mkdirSync(dirPath): VoidIOResult
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: worker/opfs\_worker\_adapter.ts:244
|
|
14
|
+
|
|
15
|
+
Sync version of `mkdir`.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Type |
|
|
20
|
+
| ------ | ------ |
|
|
21
|
+
| `dirPath` | `string` |
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`VoidIOResult`
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / move
|
|
6
|
+
|
|
7
|
+
# Function: move()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function move(
|
|
11
|
+
srcPath,
|
|
12
|
+
destPath,
|
|
13
|
+
options?): AsyncVoidIOResult
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Defined in: fs/opfs\_ext.ts:412
|
|
17
|
+
|
|
18
|
+
Move a file or directory from an old path to a new path.
|
|
19
|
+
|
|
20
|
+
## Parameters
|
|
21
|
+
|
|
22
|
+
| Parameter | Type | Description |
|
|
23
|
+
| ------ | ------ | ------ |
|
|
24
|
+
| `srcPath` | `string` | The current path of the file or directory. |
|
|
25
|
+
| `destPath` | `string` | The new path of the file or directory. |
|
|
26
|
+
| `options`? | [`MoveOptions`](../interfaces/MoveOptions.md) | Options of move. |
|
|
27
|
+
|
|
28
|
+
## Returns
|
|
29
|
+
|
|
30
|
+
`AsyncVoidIOResult`
|
|
31
|
+
|
|
32
|
+
A promise that resolves to an `AsyncIOResult`
|
|
33
|
+
indicating whether the file or directory was
|
|
34
|
+
successfully moved.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / moveSync
|
|
6
|
+
|
|
7
|
+
# Function: moveSync()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function moveSync(
|
|
11
|
+
srcPath,
|
|
12
|
+
destPath,
|
|
13
|
+
options?): VoidIOResult
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Defined in: worker/opfs\_worker\_adapter.ts:258
|
|
17
|
+
|
|
18
|
+
Sync version of `move`.
|
|
19
|
+
|
|
20
|
+
## Parameters
|
|
21
|
+
|
|
22
|
+
| Parameter | Type |
|
|
23
|
+
| ------ | ------ |
|
|
24
|
+
| `srcPath` | `string` |
|
|
25
|
+
| `destPath` | `string` |
|
|
26
|
+
| `options`? | [`MoveOptions`](../interfaces/MoveOptions.md) |
|
|
27
|
+
|
|
28
|
+
## Returns
|
|
29
|
+
|
|
30
|
+
`VoidIOResult`
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
[**@themartiancompany/opfs**](../README.md)
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
[@themartiancompany/opfs](../README.md) / pruneTemp
|
|
6
|
+
|
|
7
|
+
# Function: pruneTemp()
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
function pruneTemp(expired): AsyncVoidIOResult
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Defined in: fs/opfs\_tmp.ts:95
|
|
14
|
+
|
|
15
|
+
Prune the temporary directory and delete all expired files.
|
|
16
|
+
|
|
17
|
+
## Parameters
|
|
18
|
+
|
|
19
|
+
| Parameter | Type | Description |
|
|
20
|
+
| ------ | ------ | ------ |
|
|
21
|
+
| `expired` | `Date` | The date to determine whether a file is expired. |
|
|
22
|
+
|
|
23
|
+
## Returns
|
|
24
|
+
|
|
25
|
+
`AsyncVoidIOResult`
|
|
26
|
+
|
|
27
|
+
A promise that resolves to an `AsyncVoidIOResult`
|
|
28
|
+
indicating whether the temporary directory was successfully pruned.
|