UNPKG

epub3

Version:

Create Epub3 Files. Also includes a Scarfolding tool

62 lines (48 loc) 1.44 kB
/** * * Created by Larry Eliemenye on 16/08/2014. * Directory has to contain valid epub 3 files as specifed by OCF */ module.exports = (function () { 'use strict'; var child = require("child_process").fork('./lib/Process.js', ['special']), workspaceRoot = "./workspace", content = require("./content"); var create = function (email, dir, callback) { var inputDir = dir || workspaceRoot + "/" + email; console.log(inputDir); /*process.stdin.resume(); process.stdin.setEncoding('utf8'); process.stdin.on('data', function (text) { console.log(text) if (text === "quit\n") { done(); } }) function done(){ console.log("Creating Epub....."); }*/ //execute call back when process return message child.on('message', function (event) { callback(event); }); child.on('error', function (msg) { console.log(msg); }); //create scarfold on another process child.send({ msgType: 'scarfold', inputDir: inputDir }); }; var validate = function (dir) { } var read = function (email, pubId, callback) { content.readContent(email, pubId, callback); } return{ create:create, read:read, validate:validate } })();