Closed jiangjiangcau closed 1 month ago
There's a subtle difference in how the web (online) and npm frontends operate.
The web version checks the file extension and if it's .glb
proceeds with GLB format checks.
The validateBytes
function from the npm version does not know the file extension and tries to guess the file format based on the first byte. If that byte is g
, the file is assumed to be GLB; if that byte is one of the valid leading JSON bytes, the file is assumed to be glTF JSON. If the first byte is unrecognized, validateBytes
completes with an error instead of the validation report.
I followed the instruction in https://www.npmjs.com/package/gltf-validator to validate a GLB file. This file has invalid magic value, which can be detected by https://github.khronos.org/glTF-Validator/. But https://www.npmjs.com/package/gltf-validator cannot detect it. Does NPM version miss anything?