epub-press-js
A javascript client for building books with EpubPress.
Install
npm install --save epub-press-js
Test
Unit Tests
npm test
Browser Test
open tests/browserTest.html
NodeJS Test
node tests/nodeTest.js
Build
# Single build npm run-script build # Build + watch npm start
Usage
Browser
NodeJS
const EpubPress = ;
Creating a Book
const ebook = title: 'Best of HackerNews' description: 'Favorite articles from HackerNews in May, 2016' sections: url: 'http://medium.com/@techBlogger/why-javascript-is-dead-long-live-php' html: '<html><body><p>Lulz.</p></body></html>' ; // OR const ebook = title: 'Best of HackerNews' description: 'Favorite articles from HackerNews in May, 2016' urls: 'http://medium.com/@techBlogger/why-js-is-dead-long-live-php' ;
Publishing
ebook;
Checking Status
ebook;
Event Listening
const onStatusUpdate = { console; }; // Adding callbackebook; // Removing callbackebook
Check for updates
// epub-press-js updatesEpubPress; // epub-press-chrome updatesEpubPress;
API
new EpubPress(metadata) => ebook
metadata.sections
: Object with the url and html for a chapter.metadata.urls
: Array of urls.metadata.title
: Title for the book.metadata.description
: Description for the book.metadata.filetype
: File format to use for downloads.
ebook.publish() => Promise
ebook.download(filetype) => Promise
filetype
:'mobi'
or'epub'
(Default'epub'
)
ebook.email(email, filetype) => Promise
filetype
:'mobi'
or'epub'
(Default'epub'
)email
: Email address to deliver ebook to.
ebook.checkStatus() => Promise => status
status.progress
: Percentage complete. (0 -> 100)status.message
: Status message.
ebook.on('statusUpdate', (status) => {}) => callback
status.progress
: Percentage complete. (0 -> 100)status.message
: Description of current step.
ebook.removeListener(eventName, callback)
eventName
: Name of the eventcallback
exists on.callback
: Listener to be removed.
EpubPress.checkForUpdates(clientName, clientVersion) => Promise => Update Message | undefined
clientName
: EpubPress client library to check. (Default:epub-press-js
)clientVersion
: Version of client. (Default:EpubPress.VERSION
)
Issues
- Safari downloads the file as
Unknown
. You then must manually add the file extension (eg..epub
or.mobi
)
Feel free to report any other issues:
- In the Github repo: https://github.com/haroldtreen/epub-press-clients
- By email: support@epub.press