@gethashd/bytecave-browser 1.0.41 → 1.0.43

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.
@@ -6143,7 +6143,13 @@ var StorageWebSocketClient = class {
6143
6143
  await this.connect();
6144
6144
  }
6145
6145
  const requestId = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
6146
- const base64Data = btoa(String.fromCharCode(...options.data));
6146
+ const chunkSize = 8192;
6147
+ let binaryString = "";
6148
+ for (let i = 0; i < options.data.length; i += chunkSize) {
6149
+ const chunk = options.data.subarray(i, i + chunkSize);
6150
+ binaryString += String.fromCharCode(...chunk);
6151
+ }
6152
+ const base64Data = btoa(binaryString);
6147
6153
  const request = {
6148
6154
  type: "storage-request",
6149
6155
  requestId,
@@ -7385,7 +7391,7 @@ function useHashdUrl(hashdUrl) {
7385
7391
  URL.revokeObjectURL(blobUrl);
7386
7392
  }
7387
7393
  };
7388
- }, [hashdUrl, retrieve]);
7394
+ }, [hashdUrl]);
7389
7395
  return { blobUrl, loading, error };
7390
7396
  }
7391
7397
 
package/dist/index.cjs CHANGED
@@ -6196,7 +6196,13 @@ var StorageWebSocketClient = class {
6196
6196
  await this.connect();
6197
6197
  }
6198
6198
  const requestId = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);
6199
- const base64Data = btoa(String.fromCharCode(...options.data));
6199
+ const chunkSize = 8192;
6200
+ let binaryString = "";
6201
+ for (let i = 0; i < options.data.length; i += chunkSize) {
6202
+ const chunk = options.data.subarray(i, i + chunkSize);
6203
+ binaryString += String.fromCharCode(...chunk);
6204
+ }
6205
+ const base64Data = btoa(binaryString);
6200
6206
  const request = {
6201
6207
  type: "storage-request",
6202
6208
  requestId,
@@ -7580,7 +7586,7 @@ function useHashdUrl(hashdUrl) {
7580
7586
  URL.revokeObjectURL(blobUrl);
7581
7587
  }
7582
7588
  };
7583
- }, [hashdUrl, retrieve]);
7589
+ }, [hashdUrl]);
7584
7590
  return { blobUrl, loading, error };
7585
7591
  }
7586
7592
 
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  useHashdImage,
14
14
  useHashdMedia,
15
15
  useHashdUrl
16
- } from "./chunk-DOBNBGXF.js";
16
+ } from "./chunk-AS5ZERB4.js";
17
17
  import {
18
18
  clearHashdCache,
19
19
  createHashdUrl,
@@ -6426,7 +6426,7 @@ function useHashdUrl(hashdUrl) {
6426
6426
  URL.revokeObjectURL(blobUrl);
6427
6427
  }
6428
6428
  };
6429
- }, [hashdUrl, retrieve]);
6429
+ }, [hashdUrl]);
6430
6430
  return { blobUrl, loading, error };
6431
6431
  }
6432
6432
  // Annotate the CommonJS export names for ESM import in node:
@@ -8,7 +8,7 @@ import {
8
8
  useHashdImage,
9
9
  useHashdMedia,
10
10
  useHashdUrl
11
- } from "../chunk-DOBNBGXF.js";
11
+ } from "../chunk-AS5ZERB4.js";
12
12
  import "../chunk-EEZWRIUI.js";
13
13
  export {
14
14
  HashdAudio,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gethashd/bytecave-browser",
3
- "version": "1.0.41",
3
+ "version": "1.0.43",
4
4
  "description": "ByteCave browser client for WebRTC P2P connections to storage nodes",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -62,7 +62,7 @@ export function useHashdUrl(hashdUrl: string | null | undefined): UseHashdUrlRes
62
62
  URL.revokeObjectURL(blobUrl);
63
63
  }
64
64
  };
65
- }, [hashdUrl, retrieve]);
65
+ }, [hashdUrl]); // eslint-disable-line react-hooks/exhaustive-deps
66
66
 
67
67
  return { blobUrl, loading, error };
68
68
  }
@@ -152,7 +152,14 @@ export class StorageWebSocketClient {
152
152
  Math.random().toString(36).substring(2, 15);
153
153
 
154
154
  // Convert Uint8Array to base64
155
- const base64Data = btoa(String.fromCharCode(...options.data));
155
+ // Chunk the data to avoid stack overflow with large files
156
+ const chunkSize = 8192;
157
+ let binaryString = '';
158
+ for (let i = 0; i < options.data.length; i += chunkSize) {
159
+ const chunk = options.data.subarray(i, i + chunkSize);
160
+ binaryString += String.fromCharCode(...chunk);
161
+ }
162
+ const base64Data = btoa(binaryString);
156
163
 
157
164
  const request: StorageRequestMessage = {
158
165
  type: 'storage-request',