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);
'use strict';
var GltfPipeline = require('gltf-pipeline');
var getBinaryGltf = GltfPipeline.getBinaryGltf;
var loadGltfUris = GltfPipeline.loadGltfUris;
var parseBinaryGltf = GltfPipeline.parseBinaryGltf;
var Pipeline = GltfPipeline.Pipeline;
module.exports = optimizeGltf;
/**
* Given an input buffer containing a binary glTF asset, optimize it using gltf-pipeline with the provided options
*
* @param {Buffer} glb The buffer containing the binary glTF.
* @param {Object} [options] Options specifying custom gltf-pipeline behavior.
* @returns {Promise} A promise that resolves to the optimized binary glTF.
*
* @private
*/
function optimizeGltf(glb, options) {
var gltf = parseBinaryGltf(glb);
return loadGltfUris(gltf)
.then(function() {
'use strict';
var Cesium = require('cesium');
var GltfPipeline = require('gltf-pipeline');
var Cartesian3 = Cesium.Cartesian3;
var DeveloperError = Cesium.DeveloperError;
var defaultValue = Cesium.defaultValue;
var defined = Cesium.defined;
var addCesiumRTC = GltfPipeline.addCesiumRTC;
var getBinaryGltf = GltfPipeline.getBinaryGltf;
var loadGltfUris = GltfPipeline.loadGltfUris;
var parseBinaryGltf = GltfPipeline.parseBinaryGltf;
var Pipeline = GltfPipeline.Pipeline;
module.exports = optimizeGlb;
/**
* Given an input buffer containing a binary glTF asset, optimize it using gltf-pipeline with the provided options
*
* @param {Buffer} glbBuffer The buffer containing the binary glTF.
* @param {Object} [options] Options specifying custom gltf-pipeline behavior.
* @returns {Promise} A promise that resolves to the optimized binary glTF.
* @private
*/
function optimizeGlb(glbBuffer, options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
if (!defined(glbBuffer)) {
throw new DeveloperError('glbBuffer is not defined.');
}
'use strict';
var Cesium = require('cesium');
var GltfPipeline = require('gltf-pipeline');
var Cartesian3 = Cesium.Cartesian3;
var DeveloperError = Cesium.DeveloperError;
var defaultValue = Cesium.defaultValue;
var defined = Cesium.defined;
var addCesiumRTC = GltfPipeline.addCesiumRTC;
var getBinaryGltf = GltfPipeline.getBinaryGltf;
var loadGltfUris = GltfPipeline.loadGltfUris;
var parseBinaryGltf = GltfPipeline.parseBinaryGltf;
var Pipeline = GltfPipeline.Pipeline;
module.exports = optimizeGlb;
/**
* Given an input buffer containing a binary glTF asset, optimize it using gltf-pipeline with the provided options
*
* @param {Buffer} glbBuffer The buffer containing the binary glTF.
* @param {Object} [options] Options specifying custom gltf-pipeline behavior.
* @returns {Promise} A promise that resolves to the optimized binary glTF.
* @private
*/
function optimizeGlb(glbBuffer, options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
'use strict';
var GltfPipeline = require('gltf-pipeline');
var getBinaryGltf = GltfPipeline.getBinaryGltf;
var loadGltfUris = GltfPipeline.loadGltfUris;
var parseBinaryGltf = GltfPipeline.parseBinaryGltf;
var Pipeline = GltfPipeline.Pipeline;
module.exports = optimizeGltf;
/**
* Given an input buffer containing a binary glTF asset, optimize it using gltf-pipeline with the provided options
*
* @param {Buffer} glb The buffer containing the binary glTF.
* @param {Object} [options] Options specifying custom gltf-pipeline behavior.
* @returns {Promise} A promise that resolves to the optimized binary glTF.
*
* @private
*/
function optimizeGltf(glb, options) {
'use strict';
var GltfPipeline = require('gltf-pipeline');
var getBinaryGltf = GltfPipeline.getBinaryGltf;
var loadGltfUris = GltfPipeline.loadGltfUris;
var parseBinaryGltf = GltfPipeline.parseBinaryGltf;
var Pipeline = GltfPipeline.Pipeline;
module.exports = optimizeGltf;
/**
* Given an input buffer containing a binary glTF asset, optimize it using gltf-pipeline with the provided options
*
* @param {Buffer} glb The buffer containing the binary glTF.
* @param {Object} [options] Options specifying custom gltf-pipeline behavior.
* @returns {Promise} A promise that resolves to the optimized binary glTF.
*
* @private
*/
function optimizeGltf(glb, options) {
var gltf = parseBinaryGltf(glb);
'use strict';
var Cesium = require('cesium');
var GltfPipeline = require('gltf-pipeline');
var Cartesian3 = Cesium.Cartesian3;
var DeveloperError = Cesium.DeveloperError;
var defaultValue = Cesium.defaultValue;
var defined = Cesium.defined;
var addCesiumRTC = GltfPipeline.addCesiumRTC;
var getBinaryGltf = GltfPipeline.getBinaryGltf;
var loadGltfUris = GltfPipeline.loadGltfUris;
var parseBinaryGltf = GltfPipeline.parseBinaryGltf;
var Pipeline = GltfPipeline.Pipeline;
module.exports = optimizeGlb;
/**
* Given an input buffer containing a binary glTF asset, optimize it using gltf-pipeline with the provided options
*
* @param {Buffer} glbBuffer The buffer containing the binary glTF.
* @param {Object} [options] Options specifying custom gltf-pipeline behavior.
* @returns {Promise} A promise that resolves to the optimized binary glTF.
* @private
*/
function optimizeGlb(glbBuffer, options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
if (!defined(glbBuffer)) {
'use strict';
var GltfPipeline = require('gltf-pipeline');
var getBinaryGltf = GltfPipeline.getBinaryGltf;
var loadGltfUris = GltfPipeline.loadGltfUris;
var parseBinaryGltf = GltfPipeline.parseBinaryGltf;
var Pipeline = GltfPipeline.Pipeline;
module.exports = optimizeGltf;
/**
* Given an input buffer containing a binary glTF asset, optimize it using gltf-pipeline with the provided options
*
* @param {Buffer} glb The buffer containing the binary glTF.
* @param {Object} [options] Options specifying custom gltf-pipeline behavior.
* @returns {Promise} A promise that resolves to the optimized binary glTF.
*
* @private
*/
function optimizeGltf(glb, options) {
var gltf = parseBinaryGltf(glb);
return loadGltfUris(gltf)
'use strict';
var Cesium = require('cesium');
var GltfPipeline = require('gltf-pipeline');
var Cartesian3 = Cesium.Cartesian3;
var DeveloperError = Cesium.DeveloperError;
var defaultValue = Cesium.defaultValue;
var defined = Cesium.defined;
var addCesiumRTC = GltfPipeline.addCesiumRTC;
var getBinaryGltf = GltfPipeline.getBinaryGltf;
var loadGltfUris = GltfPipeline.loadGltfUris;
var parseBinaryGltf = GltfPipeline.parseBinaryGltf;
var Pipeline = GltfPipeline.Pipeline;
module.exports = optimizeGlb;
/**
* Given an input buffer containing a binary glTF asset, optimize it using gltf-pipeline with the provided options
*
* @param {Buffer} glbBuffer The buffer containing the binary glTF.
* @param {Object} [options] Options specifying custom gltf-pipeline behavior.
* @returns {Promise} A promise that resolves to the optimized binary glTF.
* @private
*/
function optimizeGlb(glbBuffer, options) {
options = defaultValue(options, defaultValue.EMPTY_OBJECT);
if (!defined(glbBuffer)) {
throw new DeveloperError('glbBuffer is not defined.');