padTo4Bytes is no longer used in @loaders.gl/loader-utils
See original GitHub issueHi! 👋
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:
- Created 2 years ago
- Reactions:4
- Comments:8 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
sorry, i’m spending time this week to address these issue
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.