libfw-client 0.3.0 → 0.3.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/index.js CHANGED
@@ -191,11 +191,16 @@ export class LibfwClient {
191
191
  * (same-origin when empty). The engine drives all control commands
192
192
  * and data transfer over plain HTTP (parallel `Range` downloads,
193
193
  * tus-style chunked uploads) — no WebSocket is used.
194
- * @param {number} [options.concurrency=4] max concurrently-transferring files
195
- * @param {number} [options.uploadWindow=8] in-flight chunk window for a
196
- * single file's upload; independent of `concurrency`, keeps a
197
- * high-latency link saturated (raise it to reduce upload stutter;
198
- * keep within your server's connection limit, ~6 for HTTP/1.1)
194
+ * @param {number} [options.concurrency=4] global cap on concurrent
195
+ * in-flight HTTP transfers (files and per-file chunk/range windows
196
+ * combined). Every chunk upload and range download takes a shared
197
+ * permit, so this is what actually bounds the engine's network
198
+ * parallelism set it to your server/browser connection budget
199
+ * (e.g. 1 = strictly one transfer at a time).
200
+ * @param {number} [options.uploadWindow=8] per-file scheduling window for a
201
+ * single file's upload: keeps that file's read/compress pipeline
202
+ * full on high-latency links, but the TOTAL in-flight requests never
203
+ * exceed `concurrency`
199
204
  * @param {number} [options.downloadWindow=4] in-flight byte-range window
200
205
  * for a single file's download. Large files are fetched as
201
206
  * `downloadWindow` concurrent `Range` GETs (tus-style parallel
@@ -209,6 +214,9 @@ export class LibfwClient {
209
214
  * SDK still receives data strictly in order.
210
215
  * @param {boolean} [options.compress=true] negotiate zrip compression
211
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)
212
220
  * @param {number} [options.maxRetries=3] retries per chunk/file before failing
213
221
  * @param {number} [options.baseRetryDelayMs=500] initial backoff (ms)
214
222
  * @param {number} [options.maxRetryDelayMs=30000] backoff ceiling (ms)
@@ -665,11 +673,14 @@ export class LibfwClient {
665
673
  this._fallback.buffers.set(path, buf);
666
674
  this._fallback.order.push(path);
667
675
  }
668
- // A chunk whose absolute offset is at or before the last one delivered
669
- // means the engine restarted this file (an internal retry re-delivers
670
- // the same byte range) — drop the partial buffer so the prefix is not
671
- // duplicated in the produced blob/zip.
672
- if (offset <= buf.len) {
676
+ // A chunk whose absolute offset is BEFORE the buffered span means the
677
+ // engine restarted this file (an internal retry re-delivers the same
678
+ // byte range) — drop the partial buffer so the prefix is not duplicated
679
+ // in the produced blob/zip. Note: `offset === buf.len` is the NORMAL
680
+ // next-chunk case (chunk N ends exactly where chunk N+1 begins), so it
681
+ // must NOT be treated as a restart — otherwise the first chunk of every
682
+ // browser-mode download is silently dropped.
683
+ if (offset < buf.len) {
673
684
  buf.chunks = [];
674
685
  buf.len = 0;
675
686
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libfw-client",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
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",
@@ -97,6 +97,7 @@ export interface InitOutput {
97
97
  readonly libfwclient_upload: (a: number, b: number, c: number, d: number, e: number) => any;
98
98
  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];
99
99
  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;
100
+ readonly wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke_______true_: (a: number, b: number) => void;
100
101
  readonly __wbindgen_malloc: (a: number, b: number) => number;
101
102
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
102
103
  readonly __wbindgen_exn_store: (a: number) => void;
@@ -227,6 +227,9 @@ function __wbg_get_imports() {
227
227
  __wbg__wbg_cb_unref_fffb441def202758: function(arg0) {
228
228
  arg0._wbg_cb_unref();
229
229
  },
230
+ __wbg_abort_4426bc6bd4153680: function() { return handleError(function (arg0) {
231
+ arg0.abort();
232
+ }, arguments); },
230
233
  __wbg_apply_3ac86a26fdb56c05: function() { return handleError(function (arg0, arg1, arg2) {
231
234
  const ret = arg0.apply(arg1, arg2);
232
235
  return ret;
@@ -243,6 +246,9 @@ function __wbg_get_imports() {
243
246
  const ret = arg0.call(arg1, arg2);
244
247
  return ret;
245
248
  }, arguments); },
249
+ __wbg_clearInterval_2e2069e95ad09d4f: function(arg0, arg1) {
250
+ arg0.clearInterval(arg1);
251
+ },
246
252
  __wbg_encodeURIComponent_d0140ae6e13eb27b: function(arg0, arg1) {
247
253
  const ret = encodeURIComponent(getStringFromWasm0(arg0, arg1));
248
254
  return ret;
@@ -324,6 +330,10 @@ function __wbg_get_imports() {
324
330
  const ret = new Array();
325
331
  return ret;
326
332
  },
333
+ __wbg_new_6b1dd7bed0e5462c: function() { return handleError(function () {
334
+ const ret = new XMLHttpRequest();
335
+ return ret;
336
+ }, arguments); },
327
337
  __wbg_new_aec3e25493d729fe: function(arg0, arg1) {
328
338
  try {
329
339
  var state0 = {a: arg0, b: arg1};
@@ -380,10 +390,17 @@ function __wbg_get_imports() {
380
390
  const ret = new Request(getStringFromWasm0(arg0, arg1), arg2);
381
391
  return ret;
382
392
  }, arguments); },
393
+ __wbg_now_86c0d4ba3fa605b8: function() {
394
+ const ret = Date.now();
395
+ return ret;
396
+ },
383
397
  __wbg_of_5f1b88183ddb5d94: function(arg0, arg1) {
384
398
  const ret = Array.of(arg0, arg1);
385
399
  return ret;
386
400
  },
401
+ __wbg_open_90286a4ce0ae2098: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
402
+ arg0.open(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4), arg5 !== 0);
403
+ }, arguments); },
387
404
  __wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
388
405
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
389
406
  },
@@ -406,10 +423,24 @@ function __wbg_get_imports() {
406
423
  const ret = arg0.read();
407
424
  return ret;
408
425
  },
426
+ __wbg_readyState_e916e521239696c1: function(arg0) {
427
+ const ret = arg0.readyState;
428
+ return ret;
429
+ },
409
430
  __wbg_resolve_2191a4dfe481c25b: function(arg0) {
410
431
  const ret = Promise.resolve(arg0);
411
432
  return ret;
412
433
  },
434
+ __wbg_send_4a966e8f532ab09b: function() { return handleError(function (arg0, arg1, arg2) {
435
+ arg0.send(arg1 === 0 ? undefined : getArrayU8FromWasm0(arg1, arg2));
436
+ }, arguments); },
437
+ __wbg_setInterval_93ec7461c3650c76: function() { return handleError(function (arg0, arg1, arg2) {
438
+ const ret = arg0.setInterval(arg1, arg2);
439
+ return ret;
440
+ }, arguments); },
441
+ __wbg_setRequestHeader_fe390ff50d349432: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
442
+ arg0.setRequestHeader(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
443
+ }, arguments); },
413
444
  __wbg_setTimeout_725a27c387d005c7: function() { return handleError(function (arg0, arg1, arg2, arg3) {
414
445
  const ret = arg0.setTimeout(arg1, arg2, arg3);
415
446
  return ret;
@@ -434,6 +465,18 @@ function __wbg_get_imports() {
434
465
  __wbg_set_method_5532d59b92d76467: function(arg0, arg1, arg2) {
435
466
  arg0.method = getStringFromWasm0(arg1, arg2);
436
467
  },
468
+ __wbg_set_onabort_549ef96670787286: function(arg0, arg1) {
469
+ arg0.onabort = arg1;
470
+ },
471
+ __wbg_set_onerror_c810587e53729112: function(arg0, arg1) {
472
+ arg0.onerror = arg1;
473
+ },
474
+ __wbg_set_onprogress_ba0113ededd552ae: function(arg0, arg1) {
475
+ arg0.onprogress = arg1;
476
+ },
477
+ __wbg_set_onreadystatechange_14ce44725c7e0789: function(arg0, arg1) {
478
+ arg0.onreadystatechange = arg1;
479
+ },
437
480
  __wbg_static_accessor_GLOBAL_4ef717fb391d88b7: function() {
438
481
  const ret = typeof global === 'undefined' ? null : global;
439
482
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
@@ -450,6 +493,10 @@ function __wbg_get_imports() {
450
493
  const ret = typeof window === 'undefined' ? null : window;
451
494
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
452
495
  },
496
+ __wbg_status_bab532bcb3b5d775: function() { return handleError(function (arg0) {
497
+ const ret = arg0.status;
498
+ return ret;
499
+ }, arguments); },
453
500
  __wbg_status_c45b3b9b3033184a: function(arg0) {
454
501
  const ret = arg0.status;
455
502
  return ret;
@@ -462,17 +509,26 @@ function __wbg_get_imports() {
462
509
  const ret = arg0.then(arg1);
463
510
  return ret;
464
511
  },
512
+ __wbg_upload_65cdbdfcc901f1b1: function() { return handleError(function (arg0) {
513
+ const ret = arg0.upload;
514
+ return ret;
515
+ }, arguments); },
465
516
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
466
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 145, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
517
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 163, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
467
518
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___wasm_bindgen_1e05ddb24c0b7df4___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_1e05ddb24c0b7df4___JsError___true_);
468
519
  return ret;
469
520
  },
470
- __wbindgen_cast_0000000000000002: function(arg0) {
521
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
522
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 5, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
523
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke_______true_);
524
+ return ret;
525
+ },
526
+ __wbindgen_cast_0000000000000003: function(arg0) {
471
527
  // Cast intrinsic for `F64 -> Externref`.
472
528
  const ret = arg0;
473
529
  return ret;
474
530
  },
475
- __wbindgen_cast_0000000000000003: function(arg0, arg1) {
531
+ __wbindgen_cast_0000000000000004: function(arg0, arg1) {
476
532
  // Cast intrinsic for `Ref(String) -> Externref`.
477
533
  const ret = getStringFromWasm0(arg0, arg1);
478
534
  return ret;
@@ -493,6 +549,10 @@ function __wbg_get_imports() {
493
549
  };
494
550
  }
495
551
 
552
+ function wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke_______true_(arg0, arg1) {
553
+ wasm.wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke_______true_(arg0, arg1);
554
+ }
555
+
496
556
  function wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___wasm_bindgen_1e05ddb24c0b7df4___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_1e05ddb24c0b7df4___JsError___true_(arg0, arg1, arg2) {
497
557
  const ret = wasm.wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke___wasm_bindgen_1e05ddb24c0b7df4___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_1e05ddb24c0b7df4___JsError___true_(arg0, arg1, arg2);
498
558
  if (ret[1]) {
Binary file
@@ -18,6 +18,7 @@ export const libfwclient_total_bytes: (a: number) => number;
18
18
  export const libfwclient_upload: (a: number, b: number, c: number, d: number, e: number) => any;
19
19
  export const 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];
20
20
  export const 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;
21
+ export const wasm_bindgen_1e05ddb24c0b7df4___convert__closures_____invoke_______true_: (a: number, b: number) => void;
21
22
  export const __wbindgen_malloc: (a: number, b: number) => number;
22
23
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
23
24
  export const __wbindgen_exn_store: (a: number) => void;
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.3.0",
5
+ "version": "0.3.2",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",