How to create a GLTF Sequence from Command Line/Script?

I will link the Github page for my script, but i’ll also add what is relevant here in the forum. Mostly because the actual script is a mess, lol.

// Define in and out directories
const __dirname = path.basename('./models');
const outDir = path.join(__dirname, 'GLTF Out');

// get .obj files by filtering all files in the directory
// by extension type
const files = fs.readdirSync(__dirname);
const targetFiles = files.filter(file => {
    return path.extname(file).toLowerCase() === ".obj"
});

// Convert OBJ to GLTF using obj2gltf

for (const file in targetFiles) {
    const fn = path.join(__dirname, targetFiles[file]); // get .obj path
// changeExtension is a tiny function I wrote so that I can pass
// the correct namesake to the writeFileSync call later on. I will write out below
    const fn_out = path.join(outDir, changeExtension(targetFiles[file], ".gltf"));

    obj2gltf(fn)
         .then(function (gltf){
             const data = Buffer.from(JSON.stringify(gltf));
             fs.writeFileSync(fn_out, data);
         });

Following that, I have my NodeIO instance and a document instance. For debugging, I simply use console.log(io.read("file/path.gltf") using a path to different directories to test different issues. Mostly the relative ./models/GLTF Out.

I have a feeling that I am not using the obj2gltf library correctly, but their documentation on Github isn’t extremely clear when using it as a library instead of a CLI.

For example, in the above code after the promise is returned, I pass ‘gltf’ as an argument, but its never really explained what that is. I would assume if they had a switch or some other factory pattern inside they would take that parameter in as a string, but I’m not sure what the idea is… Their example for glTFToGLB is also confusing, I feel like I am missing something.