Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function readAndOptimizeB3dm(inputPath, outputPath, force, optionArgs) {
var options = GltfPipeline.parseArguments(optionArgs);
outputPath = defaultValue(outputPath, inputPath.slice(0, inputPath.length - 5) + '-optimized.b3dm');
var gzipped;
var b3dm;
return checkFileOverwritable(outputPath, force)
.then(function() {
return fsExtra.readFile(inputPath);
})
.then(function(fileBuffer) {
gzipped = isGzipped(fileBuffer);
if (isGzipped(fileBuffer)) {
return zlibGunzip(fileBuffer);
}
return fileBuffer;
})
.then(function(fileBuffer) {
b3dm = extractB3dm(fileBuffer);
function readAndOptimizeI3dm(inputPath, outputPath, force, optionArgs) {
var options = GltfPipeline.parseArguments(optionArgs);
outputPath = defaultValue(outputPath, inputPath.slice(0, inputPath.length - 5) + '-optimized.i3dm');
var gzipped;
var i3dm;
return checkFileOverwritable(outputPath, force)
.then(function() {
return fsExtra.readFile(inputPath);
})
.then(function(fileBuffer) {
gzipped = isGzipped(fileBuffer);
if (isGzipped(fileBuffer)) {
return zlibGunzip(fileBuffer);
}
return fileBuffer;
})
.then(function(fileBuffer) {
i3dm = extractI3dm(fileBuffer);