New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

epub-press-js

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

epub-press-js

Javascript client for building books with EpubPress.

  • 0.5.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
11
decreased by-47.62%
Maintainers
1
Weekly downloads
 
Created
Source

epub-press-js

npm npm

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
<script src="node_modules/epub-press-js/build/index.js"></script>
<script>var EpubPress = window.EpubPress;</script>
NodeJS
const EpubPress = require('epub-press-js');
Creating a Book
const ebook = new EpubPress({
    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 = new EpubPress({
    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.publish().then(() =>
    ebook.download();  // Default epub
    // or ebook.email('epubpress@gmail.com')
).then(() => {
    console.log('Success!');
}).catch((error) => {
    console.log(`Error: ${error}`);
});
Checking Status
ebook.checkStatus().then((status) => {

}).catch((error) => {});
Event Listening
const onStatusUpdate = (status) => { console.log(status.message); };

// Adding callback
ebook.on('statusUpdate', onStatusUpdate);

// Removing callback
ebook.removeListener('statusUpdate', onStatusUpdate)
Check for updates
// epub-press-js updates
EpubPress.checkForUpdates().then((message) => {
    console.log(message); // Undefined if no update required
});

// epub-press-chrome updates
EpubPress.checkForUpdates('epub-press-chrome', '0.9.0').then((message) => {
    console.log(message);
});

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 event callback 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:

Keywords

FAQs

Package last updated on 23 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc