vaporbook / epub2web Goto Github PK
View Code? Open in Web Editor NEWCombines epub-cache with epub2html in order to make Epub content readable via a browser, without special plugins, extensions or hacks.
Combines epub-cache with epub2html in order to make Epub content readable via a browser, without special plugins, extensions or hacks.
Uncaught TypeError: Cannot read property 'easy' of undefined
testreader.html:550 Uncaught TypeError: Cannot read property 'htmlNav' of undefined
i get this error. WHy?
When I run node test/test.js, or any js file in the test directory, this happens:
/Users/nick/node_modules/epub2web/lib/epub2web.js:12
var parser = cacher.getParser();
^
TypeError: Object #<Object> has no method 'getParser'
at Object.<anonymous> (/Users/nick/node_modules/epub2web/lib/epub2web.js:12:21)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (/Users/nick/node_modules/epub2web/index.js:1:80)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
Hi,
I'm using two routes - one for reading sample and one for reading full-book. And ofcourse for sample, I don't have to worry about if user purchased the book or not. While for full-book, I have to...
hence, I'm separating the epub2web in to two cachedir - one call it as "sample" in a sample nodejs route and another one call it - "bookreader" dir in its own route.
So, a user first clicks on sample and reads the book ok - a json and book gets created under sample directory just fine and reads just fine.
Now, when a user buys a book and then clicks on read book (fullbook) - server attaches a different cachedir called - "bookreader" however the actual book and json still gets created in the old "sample" folder even though I'm attaching "bookreader" cache directory.
Any ideas why this is occuring?
Thanks-
app.get('/lookinside...) {
var cacheDir = "./public/sample";
var myTemplateName = 'template1';
var myTemplateHtml = fs.readFileSync('./public/testreader2.html');
var bookfile = linkToBook;
var epubDir = cacheDir;
// add custom reading template
epub2web.attach(cacheDir);
epub2web.addTemplate(myTemplateName, myTemplateHtml.toString());
epub2web.attach(cacheDir);
// attach to any cache dir you want for cache location of exploded epubs
epub2web.webify(
linkToBook, /* full path of epub file */
myTemplateName, /* template name for reading system */
function (err, cacheId, htmlApp) { /* callback after webify complete */
// the htmlApp is the whole reading system,
// fully configured for this cacheId, so
// just pass it right to the browser
var cacheurl = '/sample/' + cacheId + '/' + req.query.eid ;
res.writeHead(302, {
'Location': cacheurl
});
res.end();
});
}
app.get('/readfullbook...) {
var cacheDir = "./public/bookreader";;
var myTemplateName = 'template2';
var myTemplateHtml = fs.readFileSync('./public/testreader.html');
var bookfile = linkToBook;
var epubDir = cacheDir;
// add custom reading template
epub2web.attach(cacheDir);
epub2web.addTemplate(myTemplateName, myTemplateHtml.toString());
// attach to any cache dir you want for cache location of exploded epubs
epub2web.attach(cacheDir);
epub2web.webify(
linkToBook, /* full path of epub file */
myTemplateName, /* template name for reading system */
function (err, cacheId, htmlApp) { /* callback after webify complete */
// the htmlApp is the whole reading system,
// fully configured for this cacheId, so
// just pass it right to the browser
var cacheurl = '/bookreader/' + cacheId + '/' + req.query.eid;
logger.verbose("/readbook cacheurl:" + cacheurl);
res.writeHead(302, {
'Location': cacheurl
});
res.end();
});
}
Cloned the repo and browsed to the test, I don't see an epub, although I do see the beginning of a nice UI. It would be great to see some actual sample content served from the epubs
directory.
Example: http://metameso.org/~joe/epub2web/test/testreader.html
When I run it, it attempts to require epub-tmpl. This is not listed in package.json.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.