@net-protocol/storage 0.1.7 → 0.1.8

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/dist/index.mjs CHANGED
@@ -655,7 +655,7 @@ function getChunkCount(data) {
655
655
  const hexWithoutPrefix = dataBytes.slice(2);
656
656
  return Math.max(1, Math.ceil(hexWithoutPrefix.length / (CHUNK_SIZE * 2)));
657
657
  }
658
- function assembleChunks(chunks) {
658
+ function assembleChunks(chunks, returnHex) {
659
659
  try {
660
660
  let assembled = chunks[0] || "0x";
661
661
  for (let i = 1; i < chunks.length; i++) {
@@ -668,6 +668,9 @@ function assembleChunks(chunks) {
668
668
  try {
669
669
  const decompressed = pako.ungzip(bytes);
670
670
  const hexString = Buffer.from(decompressed).toString("utf8");
671
+ if (returnHex) {
672
+ return hexString.startsWith("0x") ? hexString : `0x${hexString}`;
673
+ }
671
674
  const result = hexToString(hexString);
672
675
  return result;
673
676
  } catch (error) {