epub3
Version:
Create Epub3 Files. Also includes a Scarfolding tool
79 lines (58 loc) • 1.69 kB
JavaScript
/**
* Created by epublica on 18/08/2014.
*/
module.exports = (function(){
'use strict';
var fs = require("fs"),
path = require("path"),
stream = require("stream"),
xml2js = require("xml2js"),
builder = xml2js.Builder(), //just like you guessed, this builds nodes
parser = new xml2js.Parser(),
workspace = "./workspace";
var email, pubId, path;
var getSpine = function(){
//
}
var setSpine = function(spineObject){
}
var setMetadata = function(){
}
var getMetadata = function(){
var reader = fs.createReadStream(this.path);
reader.on("data", function(data){
console.log(data.toString());
})
reader.on("end", function(data){
console.log("Stream has come to its end, bye bye"+__dirname);
})
}
var getManifest = function(){
}
var setManifest = function(){
}
var setGuides = function(){
}
var getGuides = function(){
}
var readContent = function(email,pubId){
fs.exists(workspace +"/"+email + "/" + pubId, function(exists){
if(!exists)
throw new Error("cannot find Book with Id: " + pubId);
//this.email = email;
//this.pubId = pubId;
//this.path = email+"/"+pubId+"/content.opf";
});
}
return{
readContent:readContent,
setMetadata:setMetadata,
getMetadata:getMetadata,
getManifest:getManifest,
setManifest:setManifest,
getSpine:getSpine,
setSpine:setSpine,
getGuides:getGuides,
setGuides:setGuides
}
})();