question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

padTo4Bytes is no longer used in @loaders.gl/loader-utils

See original GitHub issue

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch @xviz/io@1.0.8 for the project I’m working on.

padTo4Bytes is not in @loaders.gl/loader-utils anymore. Instead, the refactored function called padToNBytes.

Here is the diff that solved my problem:

diff --git a/node_modules/@xviz/io/dist/esm/gltf/glb-builder.js b/node_modules/@xviz/io/dist/esm/gltf/glb-builder.js
index 1c977e3..f9ddbcd 100644
--- a/node_modules/@xviz/io/dist/esm/gltf/glb-builder.js
+++ b/node_modules/@xviz/io/dist/esm/gltf/glb-builder.js
@@ -1,6 +1,6 @@
 import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
 import _createClass from "@babel/runtime/helpers/esm/createClass";
-import { padTo4Bytes, copyToArray } from '@loaders.gl/loader-utils';
+import { padToNBytes, copyToArray } from '@loaders.gl/loader-utils';
 import { isImage as _isImage } from '@loaders.gl/images';
 import { getAccessorTypeFromSize, getComponentTypeFromArray } from './gltf-utils/gltf-utils';
 import encodeGLBSync from './encode-glb';
@@ -95,7 +95,7 @@ var GLBBuilder = function () {
         byteOffset: this.byteLength,
         byteLength: byteLength
       });
-      this.byteLength += padTo4Bytes(byteLength);
+      this.byteLength += padToNBytes(byteLength, 4);
       this.sourceBuffers.push(buffer);
       return this.json.bufferViews.length - 1;
     }
diff --git a/node_modules/@xviz/io/dist/esm/gltf/parse-glb.js b/node_modules/@xviz/io/dist/esm/gltf/parse-glb.js
index 102d9c1..5bc9e07 100644
--- a/node_modules/@xviz/io/dist/esm/gltf/parse-glb.js
+++ b/node_modules/@xviz/io/dist/esm/gltf/parse-glb.js
@@ -1,5 +1,5 @@
 import '../common/text-encoding';
-import { padTo4Bytes, assert } from '@loaders.gl/loader-utils';
+import { padToNBytes, assert } from '@loaders.gl/loader-utils';
 var MAGIC_glTF = 0x676c5446;
 var GLB_FILE_HEADER_SIZE = 12;
 var GLB_CHUNK_HEADER_SIZE = 8;
@@ -84,7 +84,7 @@ function parseGLBChunksSync(glb, dataView, byteOffset, options) {
       default:
     }
 
-    byteOffset += padTo4Bytes(chunkLength);
+    byteOffset += padToNBytes(chunkLength, 4);
   }
 
   return byteOffset;

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
twojtaszcommented, Apr 12, 2022

sorry, i’m spending time this week to address these issue

0reactions
twojtaszcommented, Apr 25, 2022

We have a padTo4Bytes defined in our own code, i’ve opted to just use that for the time being.

@xviz 1.0.11 published with this fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues - GitHub
Today I used patch-package to patch @xviz/io@1.0.8 for the project I'm working on. ... padTo4Bytes is no longer used in @loaders.gl/loader-utils #663.
Read more >
Upgrade Guide - loaders.gl
The module entry point in the published module is no longer transpiled to ES5 as modern ... For loader workers use the new...
Read more >
This module contains shared utilities for loaders.gl, a ... - npm
This module contains shared utilities for loaders.gl, a collection of framework-independent 3D and geospatial loaders (parsers). For ...
Read more >
How to use padTo4Bytes function in gl/loader-utils - Tabnine
Parse the JSON text into a JavaScript data structure glb.json = JSON.parse(jsonText); return padTo4Bytes(chunkLength); }. origin: visgl/loaders.gl ...
Read more >
loaders.gl - Yarn
loaders.gl is a framework in the vis.gl framework suite that provides a ... loaders focused on geospatial, 3D and big data visualization use...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found