Closed LanceMcCarthy closed 7 years ago
After retrieving the glb
it is now up to the developer to save that to a file. It's probably worth updating the README to give an example of that.
@lilleyse Thank you for the prompt response.
Yes, an example would be great. Is the glb object a byte[] at that point (when using binary flag)?
Check out https://github.com/AnalyticalGraphicsInc/obj2gltf/pull/104. It's a Buffer at that point.
Did it, thank you for the guidance.
For anyone else reading this in the future, here's the successful script:
var obj2gltf = require('obj2gltf');
var fs = require('fs');
var options = {
binary: true,
output: "Breach.glb"
}
obj2gltf("Breach.obj", options)
.then(function(glb) {
console.log(glb.length);
//Note: glb is now a Buffer
// Go here to learn more https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback
fs.writeFile(options.output, glb, (err) => {
if (err) throw err;
console.log('The file has been saved!');
});
});
A single screenshot would best explain this:
As you can see the conversion looks like it was successful as the conole logs the converted glb file size, however I'm not seeing the file afterwards.
Am I looking in the wrong place? Where did the file get exported to?