libfw-client 0.4.1 → 0.4.3

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 CHANGED
@@ -102,10 +102,10 @@ dist/libfw-client.umd.js UMD bundle (after build:umd)
102
102
  - `downloadWindow: number` (default `4`) — in-flight byte-range window per
103
103
  single file download (how many concurrent `Range` GETs); raise it on
104
104
  high-latency links. `1` disables parallelism (sequential downloads).
105
- - `downloadChunkSize: number` (default `262144`, 256 KiB) — byte range size
106
- for parallel downloads; the engine reorders in-flight chunks in memory
107
- (worst case ≈ `downloadWindow * downloadChunkSize` bytes) so the SDK
108
- still receives data in order.
105
+ - `chunkSize: number` (default `2097152`, 2 MiB) — shared size used for
106
+ both upload chunks and parallel download ranges; the engine reorders
107
+ in-flight chunks in memory (worst case ≈ `downloadWindow * chunkSize`
108
+ bytes) so the SDK still receives data in order.
109
109
  - `downloadMode: 'auto' | 'fs' | 'browser'` (default `'auto'`) — `'fs'`
110
110
  streams downloads through the File System Access API; `'browser'` buffers
111
111
  and triggers a traditional browser download (folders become `.zip`);
@@ -130,7 +130,7 @@ dist/libfw-client.umd.js UMD bundle (after build:umd)
130
130
  - `tuneStatus() → { phase, params, stats, capsHash } | null` — live
131
131
  adaptive-tuning status. `phase` is `uninitialized | ramping | settled |
132
132
  degraded`; `params` is `{ concurrency, uploadWindow, downloadWindow,
133
- chunkSize, downloadChunkSize, compressLevel }`; `stats` is
133
+ chunkSize, compressLevel }`; `stats` is
134
134
  `{ rttMs, mbps }` (EWMA request RTT, last-window throughput). `null`
135
135
  until the WASM engine is initialised.
136
136
  - Events: with `autoTune` enabled, `onEvent` additionally receives
package/index.d.ts CHANGED
@@ -55,10 +55,8 @@ export interface TuningParams {
55
55
  uploadWindow: number;
56
56
  /** In-flight byte-range GETs per single-file download. */
57
57
  downloadWindow: number;
58
- /** Upload chunk size in bytes. */
58
+ /** Shared chunk size in bytes for uploads and parallel downloads. */
59
59
  chunkSize: number;
60
- /** Download byte-range size in bytes. */
61
- downloadChunkSize: number;
62
60
  /** zrip compression level (negative = faster, positive = smaller). */
63
61
  compressLevel: number;
64
62
  }
@@ -127,13 +125,6 @@ export interface LibfwClientOptions {
127
125
  * parallelism (sequential downloads). Default `4`.
128
126
  */
129
127
  downloadWindow?: number;
130
- /**
131
- * Byte range size for parallel downloads. The engine reorders in-flight
132
- * chunks in memory (worst case ≈ `downloadWindow * downloadChunkSize`
133
- * bytes) so the SDK still receives data strictly in order. Default
134
- * `262144` (256 KiB).
135
- */
136
- downloadChunkSize?: number;
137
128
  /** Negotiate zrip compression. Default `true`. */
138
129
  compress?: boolean;
139
130
  /** Upload chunk size in bytes. Default 2 MiB. */
@@ -291,7 +282,7 @@ export declare class LibfwClient {
291
282
  * @returns `{ phase, params, stats, capsHash }` — `phase` is
292
283
  * `uninitialized | ramping | settled | degraded`; `params` holds the
293
284
  * tuned `concurrency` / `uploadWindow` / `downloadWindow` / `chunkSize`
294
- * / `downloadChunkSize` / `compressLevel`; `stats` is
285
+ * / `compressLevel`; `stats` is
295
286
  * `{ rttMs, mbps }` (EWMA request RTT, last-window throughput).
296
287
  * `null` until the WASM engine is initialised (or when `autoTune` is
297
288
  * disabled, `phase` stays `uninitialized`).
package/index.js CHANGED
@@ -207,16 +207,11 @@ export class LibfwClient {
207
207
  * transfer), so a single file's throughput is bounded by bandwidth
208
208
  * instead of one connection's `chunkSize / RTT` on high-latency
209
209
  * links. `1` disables parallelism (sequential downloads).
210
- * @param {number} [options.downloadChunkSize=262144] byte range size for
211
- * parallel downloads (256 KiB default). Smaller than the upload
212
- * chunk on purpose: the engine reorders in-flight chunks in memory
213
- * (worst case ≈ `downloadWindow * downloadChunkSize` bytes) so the
214
- * SDK still receives data strictly in order.
215
210
  * @param {boolean} [options.compress=true] negotiate zrip compression
216
- * @param {number} [options.chunkSize=2097152] upload chunk size in bytes
217
- * (each chunk is split into many small ~64 KiB compressed frames, so
218
- * any value works; larger = fewer, bigger POST requests — bounded
219
- * only by the server's upload limit and client memory)
211
+ * @param {number} [options.chunkSize=2097152] shared chunk size in bytes for
212
+ * both upload chunks and parallel download ranges. The same value is
213
+ * used on both paths, and any value works as long as the server and
214
+ * memory budget permit it (larger = fewer, bigger requests).
220
215
  * @param {number} [options.maxRetries=3] retries per chunk/file before failing
221
216
  * @param {number} [options.baseRetryDelayMs=500] initial backoff (ms)
222
217
  * @param {number} [options.maxRetryDelayMs=30000] backoff ceiling (ms)
@@ -272,7 +267,6 @@ export class LibfwClient {
272
267
  concurrency: 4,
273
268
  uploadWindow: 8,
274
269
  downloadWindow: 4,
275
- downloadChunkSize: 256 * 1024,
276
270
  compress: true,
277
271
  chunkSize: 2 * 1024 * 1024,
278
272
  maxRetries: 3,
@@ -338,7 +332,6 @@ export class LibfwClient {
338
332
  concurrency: this._options.concurrency,
339
333
  uploadWindow: this._options.uploadWindow,
340
334
  downloadWindow: this._options.downloadWindow,
341
- downloadChunkSize: this._options.downloadChunkSize,
342
335
  compress: this._options.compress,
343
336
  chunkSize: this._options.chunkSize,
344
337
  maxRetries: this._options.maxRetries,
@@ -1246,8 +1239,7 @@ export class LibfwClient {
1246
1239
  *
1247
1240
  * - `phase`: `uninitialized | ramping | settled | degraded`
1248
1241
  * - `params`: `{ concurrency, uploadWindow, downloadWindow, chunkSize,
1249
- * downloadChunkSize, compressLevel }` — the parameters the engine is
1250
- * currently tuned to
1242
+ * compressLevel }` — the parameters the engine is currently tuned to
1251
1243
  * - `stats`: `{ rttMs, mbps }` — EWMA request RTT and last-window
1252
1244
  * throughput of the most recent transfer
1253
1245
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libfw-client",
3
- "version": "0.4.1",
3
+ "version": "0.4.3",
4
4
  "description": "High-performance streaming file & folder transfer SDK for the browser (libfw WASM engine + File System Access API + IndexedDB resume).",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -17,14 +17,10 @@ export class LibfwClient {
17
17
  done_bytes(): number;
18
18
  /**
19
19
  * Download a single file at `file_path` into the chosen local directory.
20
- *
21
- * Resolves with the number of bytes written.
22
20
  */
23
21
  download_file(base_url: string, token: string, file_path: string): Promise<any>;
24
22
  /**
25
23
  * Download every file under the virtual `dirPath` (empty = root).
26
- *
27
- * Resolves with the number of bytes written.
28
24
  */
29
25
  download_folder(base_url: string, token: string, dir_path: string): Promise<any>;
30
26
  /**
@@ -33,8 +29,8 @@ export class LibfwClient {
33
29
  has_callbacks(): boolean;
34
30
  /**
35
31
  * Create an engine. `options` may include:
36
- * `{ concurrency, uploadWindow, downloadWindow, downloadChunkSize,
37
- * compress, compressLevel, chunkSize, maxRetries, baseRetryDelayMs,
32
+ * `{ concurrency, uploadWindow, downloadWindow, compress,
33
+ * compressLevel, chunkSize, maxRetries, baseRetryDelayMs,
38
34
  * maxRetryDelayMs, timeoutMs, autoTune, tuneTtlMs }`.
39
35
  */
40
36
  constructor(opts: any);
@@ -74,8 +70,6 @@ export class LibfwClient {
74
70
  tune_state(): any;
75
71
  /**
76
72
  * Upload the files reported by the JS `getFileList` callback.
77
- *
78
- * Resolves with the number of bytes uploaded.
79
73
  */
80
74
  upload(base_url: string, token: string): Promise<any>;
81
75
  }
@@ -111,7 +105,8 @@ export interface InitOutput {
111
105
  readonly start: () => void;
112
106
  readonly wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke___wasm_bindgen_b2c787b844a3ac79___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_b2c787b844a3ac79___JsError___true_: (a: number, b: number, c: any) => [number, number];
113
107
  readonly wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke___js_sys_209827a80d159db4___Function_fn_wasm_bindgen_b2c787b844a3ac79___JsValue_____wasm_bindgen_b2c787b844a3ac79___sys__Undefined___js_sys_209827a80d159db4___Function_fn_wasm_bindgen_b2c787b844a3ac79___JsValue_____wasm_bindgen_b2c787b844a3ac79___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
114
- readonly wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke___web_sys_b45f848915fa3e2d___features__gen_ProgressEvent__ProgressEvent______true_: (a: number, b: number, c: any) => void;
108
+ readonly wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke___wasm_bindgen_b2c787b844a3ac79___JsValue______true_: (a: number, b: number, c: any) => void;
109
+ readonly wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke___wasm_bindgen_b2c787b844a3ac79___JsValue______true__2: (a: number, b: number, c: any) => void;
115
110
  readonly wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke_______true_: (a: number, b: number) => void;
116
111
  readonly __wbindgen_malloc: (a: number, b: number) => number;
117
112
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
@@ -30,8 +30,6 @@ export class LibfwClient {
30
30
  }
31
31
  /**
32
32
  * Download a single file at `file_path` into the chosen local directory.
33
- *
34
- * Resolves with the number of bytes written.
35
33
  * @param {string} base_url
36
34
  * @param {string} token
37
35
  * @param {string} file_path
@@ -49,8 +47,6 @@ export class LibfwClient {
49
47
  }
50
48
  /**
51
49
  * Download every file under the virtual `dirPath` (empty = root).
52
- *
53
- * Resolves with the number of bytes written.
54
50
  * @param {string} base_url
55
51
  * @param {string} token
56
52
  * @param {string} dir_path
@@ -76,8 +72,8 @@ export class LibfwClient {
76
72
  }
77
73
  /**
78
74
  * Create an engine. `options` may include:
79
- * `{ concurrency, uploadWindow, downloadWindow, downloadChunkSize,
80
- * compress, compressLevel, chunkSize, maxRetries, baseRetryDelayMs,
75
+ * `{ concurrency, uploadWindow, downloadWindow, compress,
76
+ * compressLevel, chunkSize, maxRetries, baseRetryDelayMs,
81
77
  * maxRetryDelayMs, timeoutMs, autoTune, tuneTtlMs }`.
82
78
  * @param {any} opts
83
79
  */
@@ -157,8 +153,6 @@ export class LibfwClient {
157
153
  }
158
154
  /**
159
155
  * Upload the files reported by the JS `getFileList` callback.
160
- *
161
- * Resolves with the number of bytes uploaded.
162
156
  * @param {string} base_url
163
157
  * @param {string} token
164
158
  * @returns {Promise<any>}
@@ -273,9 +267,16 @@ function __wbg_get_imports() {
273
267
  const ret = arg0.call(arg1, arg2);
274
268
  return ret;
275
269
  }, arguments); },
270
+ __wbg_catch_c1a60df4c30d76d3: function(arg0, arg1) {
271
+ const ret = arg0.catch(arg1);
272
+ return ret;
273
+ },
276
274
  __wbg_clearInterval_2e2069e95ad09d4f: function(arg0, arg1) {
277
275
  arg0.clearInterval(arg1);
278
276
  },
277
+ __wbg_clearTimeout_8f80437be2324e09: function(arg0, arg1) {
278
+ arg0.clearTimeout(arg1);
279
+ },
279
280
  __wbg_encodeURIComponent_d0140ae6e13eb27b: function(arg0, arg1) {
280
281
  const ret = encodeURIComponent(getStringFromWasm0(arg0, arg1));
281
282
  return ret;
@@ -455,10 +456,6 @@ function __wbg_get_imports() {
455
456
  const ret = Date.now();
456
457
  return ret;
457
458
  },
458
- __wbg_of_5f1b88183ddb5d94: function(arg0, arg1) {
459
- const ret = Array.of(arg0, arg1);
460
- return ret;
461
- },
462
459
  __wbg_open_90286a4ce0ae2098: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
463
460
  arg0.open(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), arg5 !== 0);
464
461
  }, arguments); },
@@ -476,10 +473,6 @@ function __wbg_get_imports() {
476
473
  __wbg_queueMicrotask_6a09b7bc46549209: function(arg0) {
477
474
  queueMicrotask(arg0);
478
475
  },
479
- __wbg_race_ac5c7b465abcfa15: function(arg0) {
480
- const ret = Promise.race(arg0);
481
- return ret;
482
- },
483
476
  __wbg_read_8afa15f12a160ef8: function(arg0) {
484
477
  const ret = arg0.read();
485
478
  return ret;
@@ -508,10 +501,6 @@ function __wbg_get_imports() {
508
501
  __wbg_setRequestHeader_fe390ff50d349432: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
509
502
  arg0.setRequestHeader(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
510
503
  }, arguments); },
511
- __wbg_setTimeout_725a27c387d005c7: function() { return handleError(function (arg0, arg1, arg2, arg3) {
512
- const ret = arg0.setTimeout(arg1, arg2, arg3);
513
- return ret;
514
- }, arguments); },
515
504
  __wbg_setTimeout_cfa2cf195c3738db: function() { return handleError(function (arg0, arg1, arg2) {
516
505
  const ret = arg0.setTimeout(arg1, arg2);
517
506
  return ret;
@@ -590,6 +579,10 @@ function __wbg_get_imports() {
590
579
  const ret = arg0.then(arg1);
591
580
  return ret;
592
581
  },
582
+ __wbg_then_e0960b859f3ff223: function(arg0, arg1) {
583
+ const ret = arg0.then(arg1);
584
+ return ret;
585
+ },
593
586
  __wbg_total_21672ff1bd8d23ea: function(arg0) {
594
587
  const ret = arg0.total;
595
588
  return ret;
@@ -599,26 +592,31 @@ function __wbg_get_imports() {
599
592
  return ret;
600
593
  }, arguments); },
601
594
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
602
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 196, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
595
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 209, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
603
596
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke___wasm_bindgen_b2c787b844a3ac79___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_b2c787b844a3ac79___JsError___true_);
604
597
  return ret;
605
598
  },
606
599
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
607
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ProgressEvent")], shim_idx: 5, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
608
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke___web_sys_b45f848915fa3e2d___features__gen_ProgressEvent__ProgressEvent______true_);
600
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 5, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
601
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke___wasm_bindgen_b2c787b844a3ac79___JsValue______true_);
609
602
  return ret;
610
603
  },
611
604
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
612
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 7, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
605
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("ProgressEvent")], shim_idx: 5, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
606
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke___wasm_bindgen_b2c787b844a3ac79___JsValue______true__2);
607
+ return ret;
608
+ },
609
+ __wbindgen_cast_0000000000000004: function(arg0, arg1) {
610
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 8, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
613
611
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke_______true_);
614
612
  return ret;
615
613
  },
616
- __wbindgen_cast_0000000000000004: function(arg0) {
614
+ __wbindgen_cast_0000000000000005: function(arg0) {
617
615
  // Cast intrinsic for `F64 -> Externref`.
618
616
  const ret = arg0;
619
617
  return ret;
620
618
  },
621
- __wbindgen_cast_0000000000000005: function(arg0, arg1) {
619
+ __wbindgen_cast_0000000000000006: function(arg0, arg1) {
622
620
  // Cast intrinsic for `Ref(String) -> Externref`.
623
621
  const ret = getStringFromWasm0(arg0, arg1);
624
622
  return ret;
@@ -643,8 +641,12 @@ function wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke_______true
643
641
  wasm.wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke_______true_(arg0, arg1);
644
642
  }
645
643
 
646
- function wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke___web_sys_b45f848915fa3e2d___features__gen_ProgressEvent__ProgressEvent______true_(arg0, arg1, arg2) {
647
- wasm.wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke___web_sys_b45f848915fa3e2d___features__gen_ProgressEvent__ProgressEvent______true_(arg0, arg1, arg2);
644
+ function wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke___wasm_bindgen_b2c787b844a3ac79___JsValue______true_(arg0, arg1, arg2) {
645
+ wasm.wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke___wasm_bindgen_b2c787b844a3ac79___JsValue______true_(arg0, arg1, arg2);
646
+ }
647
+
648
+ function wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke___wasm_bindgen_b2c787b844a3ac79___JsValue______true__2(arg0, arg1, arg2) {
649
+ wasm.wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke___wasm_bindgen_b2c787b844a3ac79___JsValue______true__2(arg0, arg1, arg2);
648
650
  }
649
651
 
650
652
  function wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke___wasm_bindgen_b2c787b844a3ac79___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_b2c787b844a3ac79___JsError___true_(arg0, arg1, arg2) {
Binary file
@@ -21,7 +21,8 @@ export const libfwclient_upload: (a: number, b: number, c: number, d: number, e:
21
21
  export const start: () => void;
22
22
  export const wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke___wasm_bindgen_b2c787b844a3ac79___JsValue__core_ed718c3d60ebd546___result__Result_____wasm_bindgen_b2c787b844a3ac79___JsError___true_: (a: number, b: number, c: any) => [number, number];
23
23
  export const wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke___js_sys_209827a80d159db4___Function_fn_wasm_bindgen_b2c787b844a3ac79___JsValue_____wasm_bindgen_b2c787b844a3ac79___sys__Undefined___js_sys_209827a80d159db4___Function_fn_wasm_bindgen_b2c787b844a3ac79___JsValue_____wasm_bindgen_b2c787b844a3ac79___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
24
- export const wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke___web_sys_b45f848915fa3e2d___features__gen_ProgressEvent__ProgressEvent______true_: (a: number, b: number, c: any) => void;
24
+ export const wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke___wasm_bindgen_b2c787b844a3ac79___JsValue______true_: (a: number, b: number, c: any) => void;
25
+ export const wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke___wasm_bindgen_b2c787b844a3ac79___JsValue______true__2: (a: number, b: number, c: any) => void;
25
26
  export const wasm_bindgen_b2c787b844a3ac79___convert__closures_____invoke_______true_: (a: number, b: number) => void;
26
27
  export const __wbindgen_malloc: (a: number, b: number) => number;
27
28
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
package/pkg/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "libfw-client",
3
3
  "type": "module",
4
4
  "description": "WASM engine + JS SDK for libfw browser clients",
5
- "version": "0.4.1",
5
+ "version": "0.4.3",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",