libfw-client 0.1.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/README.md +77 -0
- package/index.d.ts +137 -0
- package/index.js +478 -0
- package/package.json +46 -0
- package/pkg/libfw_client.d.ts +123 -0
- package/pkg/libfw_client.js +784 -0
- package/pkg/libfw_client_bg.wasm +0 -0
- package/pkg/libfw_client_bg.wasm.d.ts +28 -0
- package/pkg/package.json +28 -0
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "libfw-client",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "High-performance streaming file & folder transfer SDK for the browser (libfw WASM engine + File System Access API + IndexedDB resume).",
|
|
5
|
+
"license": "MIT OR Apache-2.0",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "index.js",
|
|
8
|
+
"module": "index.js",
|
|
9
|
+
"types": "index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./index.d.ts",
|
|
13
|
+
"import": "./index.js",
|
|
14
|
+
"default": "./index.js"
|
|
15
|
+
},
|
|
16
|
+
"./pkg/*": "./pkg/*"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"index.js",
|
|
20
|
+
"index.d.ts",
|
|
21
|
+
"pkg/libfw_client.js",
|
|
22
|
+
"pkg/libfw_client_bg.wasm",
|
|
23
|
+
"pkg/libfw_client.d.ts",
|
|
24
|
+
"pkg/libfw_client_bg.wasm.d.ts",
|
|
25
|
+
"pkg/package.json"
|
|
26
|
+
],
|
|
27
|
+
"sideEffects": false,
|
|
28
|
+
"scripts": {
|
|
29
|
+
"build:wasm": "wasm-pack build ../crates/libfw-client --target web --out-dir ../sdk/pkg --release",
|
|
30
|
+
"build:umd": "rollup -c rollup.config.mjs",
|
|
31
|
+
"build": "npm run build:wasm && npm run build:umd"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"libfw",
|
|
35
|
+
"transfer",
|
|
36
|
+
"upload",
|
|
37
|
+
"download",
|
|
38
|
+
"wasm",
|
|
39
|
+
"file-system-access",
|
|
40
|
+
"resumable"
|
|
41
|
+
],
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
44
|
+
"rollup": "^4.0.0"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* WASM engine facade. Construct via `new LibfwClient(options)`.
|
|
6
|
+
*/
|
|
7
|
+
export class LibfwClient {
|
|
8
|
+
free(): void;
|
|
9
|
+
[Symbol.dispose](): void;
|
|
10
|
+
/**
|
|
11
|
+
* Cancel the active transfer (state → `failed`).
|
|
12
|
+
*/
|
|
13
|
+
cancel(): void;
|
|
14
|
+
/**
|
|
15
|
+
* Bytes transferred so far.
|
|
16
|
+
*/
|
|
17
|
+
done_bytes(): number;
|
|
18
|
+
/**
|
|
19
|
+
* Download every file under the virtual `dirPath` (empty = root).
|
|
20
|
+
*
|
|
21
|
+
* Resolves with the number of bytes written.
|
|
22
|
+
*/
|
|
23
|
+
download_folder(base_url: string, token: string, dir_path: string): Promise<any>;
|
|
24
|
+
/**
|
|
25
|
+
* Whether callbacks have been installed.
|
|
26
|
+
*/
|
|
27
|
+
has_callbacks(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Create an engine. `options` may include:
|
|
30
|
+
* `{ concurrency, compress, chunkSize, maxRetries, baseRetryDelayMs,
|
|
31
|
+
* maxRetryDelayMs, timeoutMs }`.
|
|
32
|
+
*/
|
|
33
|
+
constructor(opts: any);
|
|
34
|
+
/**
|
|
35
|
+
* Pause the active transfer (state → `paused`).
|
|
36
|
+
*/
|
|
37
|
+
pause(): void;
|
|
38
|
+
/**
|
|
39
|
+
* Progress in `[0, 1]`.
|
|
40
|
+
*/
|
|
41
|
+
progress(): number;
|
|
42
|
+
/**
|
|
43
|
+
* Resume a paused transfer.
|
|
44
|
+
*/
|
|
45
|
+
resume(): void;
|
|
46
|
+
/**
|
|
47
|
+
* Install the JS callbacks object (required before any transfer).
|
|
48
|
+
*/
|
|
49
|
+
set_callbacks(callbacks: any): void;
|
|
50
|
+
/**
|
|
51
|
+
* Current state: `idle | downloading | uploading | paused | completed |
|
|
52
|
+
* failed`.
|
|
53
|
+
*/
|
|
54
|
+
state(): string;
|
|
55
|
+
/**
|
|
56
|
+
* Total bytes to transfer.
|
|
57
|
+
*/
|
|
58
|
+
total_bytes(): number;
|
|
59
|
+
/**
|
|
60
|
+
* Upload the files reported by the JS `getFileList` callback.
|
|
61
|
+
*
|
|
62
|
+
* Resolves with the number of bytes uploaded.
|
|
63
|
+
*/
|
|
64
|
+
upload(base_url: string, token: string): Promise<any>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Read an optional string field from a JS object (helper for the SDK).
|
|
69
|
+
*/
|
|
70
|
+
export function js_option_string(obj: any, key: string): string | undefined;
|
|
71
|
+
|
|
72
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
73
|
+
|
|
74
|
+
export interface InitOutput {
|
|
75
|
+
readonly memory: WebAssembly.Memory;
|
|
76
|
+
readonly __wbg_libfwclient_free: (a: number, b: number) => void;
|
|
77
|
+
readonly js_option_string: (a: any, b: number, c: number) => [number, number];
|
|
78
|
+
readonly libfwclient_cancel: (a: number) => void;
|
|
79
|
+
readonly libfwclient_done_bytes: (a: number) => number;
|
|
80
|
+
readonly libfwclient_download_folder: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => any;
|
|
81
|
+
readonly libfwclient_has_callbacks: (a: number) => number;
|
|
82
|
+
readonly libfwclient_new: (a: any) => number;
|
|
83
|
+
readonly libfwclient_pause: (a: number) => void;
|
|
84
|
+
readonly libfwclient_progress: (a: number) => number;
|
|
85
|
+
readonly libfwclient_resume: (a: number) => void;
|
|
86
|
+
readonly libfwclient_set_callbacks: (a: number, b: any) => void;
|
|
87
|
+
readonly libfwclient_state: (a: number) => [number, number];
|
|
88
|
+
readonly libfwclient_total_bytes: (a: number) => number;
|
|
89
|
+
readonly libfwclient_upload: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
90
|
+
readonly wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___wasm_bindgen_1e05ddb24c0b7df4___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_1e05ddb24c0b7df4___JsError___true_: (a: number, b: number, c: any) => [number, number];
|
|
91
|
+
readonly wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___js_sys_bb6c79d0abe11c10___Function_fn_wasm_bindgen_1e05ddb24c0b7df4___JsValue_____wasm_bindgen_1e05ddb24c0b7df4___sys__Undefined___js_sys_bb6c79d0abe11c10___Function_fn_wasm_bindgen_1e05ddb24c0b7df4___JsValue_____wasm_bindgen_1e05ddb24c0b7df4___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
|
|
92
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
93
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
94
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
95
|
+
readonly __externref_table_alloc: () => number;
|
|
96
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
97
|
+
readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
|
|
98
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
99
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
100
|
+
readonly __wbindgen_start: () => void;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
107
|
+
* a precompiled `WebAssembly.Module`.
|
|
108
|
+
*
|
|
109
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
110
|
+
*
|
|
111
|
+
* @returns {InitOutput}
|
|
112
|
+
*/
|
|
113
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
117
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
118
|
+
*
|
|
119
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
120
|
+
*
|
|
121
|
+
* @returns {Promise<InitOutput>}
|
|
122
|
+
*/
|
|
123
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|