@gethashd/bytecave-browser 1.0.42 → 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,
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,
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  useHashdImage,
14
14
  useHashdMedia,
15
15
  useHashdUrl
16
- } from "./chunk-P7BUV66R.js";
16
+ } from "./chunk-AS5ZERB4.js";
17
17
  import {
18
18
  clearHashdCache,
19
19
  createHashdUrl,
@@ -8,7 +8,7 @@ import {
8
8
  useHashdImage,
9
9
  useHashdMedia,
10
10
  useHashdUrl
11
- } from "../chunk-P7BUV66R.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.42",
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",
@@ -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',