gltf-to-glb v0.1.0
glTF to GLB
CLI tool for converting glTF to GLB.
gltf-to-glb extends the functionality of gltf-pipeline by adding hooks for preprocessing of glTF files and postprocessing of GLB files allowing you to more easily plug in certain transformations and optimisations without having to modify the core library. It also makes sure to validate your glTF file using gltf-validator to flag any potential issues before processing.
Installation
$ npm install
$ git submodule init
$ git submodule update
$ npm --prefix ./submodules/gltf-pipeline install ./submodules/gltf-pipeline
$ git submodule update --recursive --remote --forceLive demo
Live demo of a Draco compressed glTF file rendered in Three.js using HDR Image-based Lighting with run-time generated pre-filtered roughness mipmaps.

Example
Before adding further optimizations like Draco and ZLib compression you have to ask yourself: does it make sense in my context? At what point does it start making sense to use these type of optimizations?
I would say: only when you are dealing with a lot of geometry and a lot of models in your scene. Only then the upfront cost of the ZLib inflating, the Draco decoding and decompression will make up for its own cost. When you have a single model like in the live demo it is likely not worth it. A use case as shown in the video Draco 3D Geometry Compression: Comparing Draco to gzip by Google Open Source shows that it clearly is worth it when dealing with a lot of geometry.
Please note that textures don't compress well so the cost of ZLib inflating is only really worth it if your model is geometry heavy.
glTF to glb ~ 4.8M (gltf embedded) > 3.6M (glb, requires no decompression)
$ node bin/gltf-to-glb.js -i ./submodules/glTF-Sample-Models/2.0/DamagedHelmet/glTF/DamagedHelmet.gltf -o ./output/DamagedHelmet.glbglTF to glb using Draco compression ~ 4.8M (gltf embedded) > 3.1M (glb, requires Draco decompression)
$ node bin/gltf-to-glb.js -i ./submodules/glTF-Sample-Models/2.0/DamagedHelmet/glTF/DamagedHelmet.gltf -o ./output/DamagedHelmet_draco.glb -dglTF to glb using Draco compression and ZLib postprocess compression ~ 4.8M (gltf embedded) > 3.0M (glb, requires ZLib inflating and Draco decompression)
$ node bin/gltf-to-glb.js -i ./submodules/glTF-Sample-Models/2.0/DamagedHelmet/glTF/DamagedHelmet.gltf -o ./output/DamagedHelmet_draco_zlib.glb -post ./plugins/ZLibDeflatePostProcess.js -dFlags
Required
-i, --input [example: ./input/example.gltf] [required]
-o, --output [example: ./output/example.glb] [required]Optional
-d, --draco [true / false, default: false] [not required]
-s, --seperateTextures [true / false, default: false] [not required]
-pre, --preProcess [example: ./plugins/examplePreProcess.js] [not required]
-post, --postProcess [example ./plugins/examplePostProcess.js] [not required]Resources
- glTF 2.0 specification
 - glTF 2.0 sample models
 - Blender glTF 2.0 exporter
 - Drag-and-drop glTF 2.0 WebGL viewer using Three.js
 - Optimizing GLTF files as exported by Blender
 - COLLADA2GLTF
 - COLLADA2GLTF build instructions for MacOS
 - Creating ‘Qalam’ (Shared geometry, GLB, Draco compression, Base64 + GZip / MIME type trickery, loading strategies, web workers and transferable objects) by Matt Greenhalgh, Stink Studios
 - Helix.js uses ZLib inflate / deflate for binary FBX deserialization
 
Licence
My work is released under the MIT licence.