lib/main.js
function closeContainer(container_directory, opts) {
    opts = opts || { compression_method : 'tar', clean : true };
    if(!fileUtils.fileExists(container_directory)) return Promise.reject(new Error('Missing resource container'));
    var container_archive = container_directory + '.' + spec.file_ext;
    var compressPromise = Promise.resolve(container_archive);

    // create archive if it's missing
    if(!fileUtils.fileExists(container_archive)) {
        if(opts.compression_method === 'zip') {
            compressPromise = compressionUtils.zip(container_directory, container_archive);
        } else {
            compressPromise = compressionUtils.tar(container_directory, container_archive);
        }
    }
    return compressPromise.then(function(path) {
        // remove directory
        if(opts.clean) rimraf.sync(container_directory);
        return Promise.resolve(path);
    });
}
function closeContainer(container_directory, opts) {
    opts = opts || { compression_method : 'tar', clean : true };
    if(!fileUtils.fileExists(container_directory)) return Promise.reject(new Error('Missing resource container'));
    var container_archive = container_directory + '.' + spec.file_ext;
    var compressPromise = Promise.resolve(container_archive);

    // create archive if it's missing
    if(!fileUtils.fileExists(container_archive)) {
        if(opts.compression_method === 'zip') {
            compressPromise = compressionUtils.zip(container_directory, container_archive);
        } else {
            compressPromise = compressionUtils.tar(container_directory, container_archive);
        }
    }
    return compressPromise.then(function(path) {
        // remove directory
        if(opts.clean) rimraf.sync(container_directory);
        return Promise.resolve(path);
    });
}
function closeContainer ( container_directory , opts ) { opts = opts || { compression_method : 'tar' , clean : true } ; if ( ! fileUtils . fileExists ( container_directory ) ) return Promise . reject ( new Error ( 'Missing resource container' ) ) ; var container_archive = container_directory + '.' + spec . file_ext ; var compressPromise = Promise . resolve ( container_archive ) ; // create archive if it's missing if ( ! fileUtils . fileExists ( container_archive ) ) { if ( opts . compression_method === 'zip' ) { compressPromise = compressionUtils . zip ( container_directory , container_archive ) ; } else { compressPromise = compressionUtils . tar ( container_directory , container_archive ) ; } } return compressPromise . then ( function ( path ) { // remove directory if ( opts . clean ) rimraf . sync ( container_directory ) ; return Promise . resolve ( path ) ; } ) ; }
Closes (archives) a resource container.

@param container_directory {string}
@param opts {{}} extra options such as compression_method (zip or tar)
@returns {Promise<string>} the path to the resource container archive
Closes ( archives ) a resource container .