Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.make = function(epubConfig) {
console.debug('building epub', epubConfig);
var zip = new JSZip();
var deferred = D();
D.all(
addMimetype(zip),
addContainerInfo(zip, epubConfig),
addManifestOpf(zip, epubConfig),
addCover(zip, epubConfig),
addEpub2Nav(zip, epubConfig),
addEpub3Nav(zip, epubConfig),
addStylesheets(zip, epubConfig),
addContent(zip, epubConfig)
).then(function() {
deferred.resolve(zip);
});
return deferred.promise;
};
this.make = function(epubConfig) {
console.debug('building epub', epubConfig);
var zip = new JSZip();
var deferred = D();
D.all(
addMimetype(zip),
addContainerInfo(zip, epubConfig),
addManifestOpf(zip, epubConfig),
addCover(zip, epubConfig),
addEpub2Nav(zip, epubConfig),
addEpub3Nav(zip, epubConfig),
addStylesheets(zip, epubConfig),
addContent(zip, epubConfig)
).then(function() {
deferred.resolve(zip);
});
return deferred.promise;
};
this.make = function(epubConfig) {
console.debug('building epub', epubConfig);
var zip = new JSZip();
var deferred = D();
addAditionalInfo(epubConfig);
D.all(
addMimetype(zip),
addContainerInfo(zip, epubConfig),
addManifestOpf(zip, epubConfig),
addCover(zip, epubConfig),
addFiles(zip, epubConfig),
addEpub2Nav(zip, epubConfig),
addEpub3Nav(zip, epubConfig),
addStylesheets(zip, epubConfig),
addContent(zip, epubConfig)
).then(function() {
deferred.resolve(zip);
}, function(err) { console.log(err); });
return deferred.promise;
};
for(var i = 0; i < epubConfig.additionalFiles.length; i++) {
var file = epubConfig.additionalFiles[i];
var deferred = new D();
JSZipUtils.getBinaryContent(file.url, (function(file, deferred) {
return function(err, data) {
if(!err) {
zip.folder('EPUB').folder(file.folder).file(file.filename, data, { binary: true });
deferred.resolve('');
} else {
deferred.reject(err);
}
};
})(file, deferred));
deferred_list.push(deferred.promise);
}
return D.all(deferred_list);
}