src/server/worker/workerrequests.js
function _extractProjectJsonAndAddAssets(filenameOrBuffer, blobClient, callback) {
        var zip = new AdmZip(filenameOrBuffer),
            artifact = blobClient.createArtifact('files'),
            projectStr;

        return Q.all(zip.getEntries()
            .map(function (entry) {
                var entryName = entry.entryName;
                if (entryName === 'project.json') {
                    projectStr = zip.readAsText(entry);
                } else {
                    return artifact.addFileAsSoftLink(entryName, zip.readFile(entry));
                }
            })
        )
            .then(function () {
                var metadata = artifact.descriptor;
                return blobUtil.addAssetsFromExportedProject(logger, blobClient, metadata);
            })
            .then(function () {
                return JSON.parse(projectStr);
            })
            .nodeify(callback);
    }
function _extractProjectJsonAndAddAssets(filenameOrBuffer, blobClient, callback) {
        var zip = new AdmZip(filenameOrBuffer),
            artifact = blobClient.createArtifact('files'),
            projectStr;

        return Q.all(zip.getEntries()
            .map(function (entry) {
                var entryName = entry.entryName;
                if (entryName === 'project.json') {
                    projectStr = zip.readAsText(entry);
                } else {
                    return artifact.addFileAsSoftLink(entryName, zip.readFile(entry));
                }
            })
        )
            .then(function () {
                var metadata = artifact.descriptor;
                return blobUtil.addAssetsFromExportedProject(logger, blobClient, metadata);
            })
            .then(function () {
                return JSON.parse(projectStr);
            })
            .nodeify(callback);
    }
function _extractProjectJsonAndAddAssets ( filenameOrBuffer , blobClient , callback ) { var zip = new AdmZip ( filenameOrBuffer ) , artifact = blobClient . createArtifact ( 'files' ) , projectStr ; return Q . all ( zip . getEntries ( ) . map ( function ( entry ) { var entryName = entry . entryName ; if ( entryName === 'project.json' ) { projectStr = zip . readAsText ( entry ) ; } else { return artifact . addFileAsSoftLink ( entryName , zip . readFile ( entry ) ) ; } } ) ) . then ( function ( ) { var metadata = artifact . descriptor ; return blobUtil . addAssetsFromExportedProject ( logger , blobClient , metadata ) ; } ) . then ( function ( ) { return JSON . parse ( projectStr ) ; } ) . nodeify ( callback ) ; }
Extracts the exported zip file and adds the contained files to the blob using
the import-part of ExportImport Plugin.
@param {string|Buffer} filenameOrBuffer
@param {BlobClient} blobClient
@param function [callback]
@returns {string} - The project json as a string
@private
Extracts the exported zip file and adds the contained files to the blob using the import - part of ExportImport Plugin .