
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Convert ePub and MOBI files to text-based formats (JSON, Markdown, plain text)
A command-line tool to convert e-books (ePub, MOBI, and PDF) to text-based formats (JSON, Markdown, plain text). If the files are copy proected, this script will fail.
# Install globally
npm install -g book2text
# Verify installation
book2text --help
This allows you to run book2text from anywhere in your terminal.
# Install locally in your project
npm install book2text
# Run using npx
npx book2text --input book.epub
book2text --input <file-path> [options]
Options:
--input, -i: Path to the input ePub, MOBI, or PDF file (required)--format, -f: Output format: "json", "markdown", or "text" (default: "markdown")--output, -o: Output directory or file path (default: "./converted/")--clean, -c: Clean the output directory before conversion (default: false)--no-metadata: Exclude metadata from the output (default: include metadata)--no-toc: Exclude table of contents from the output (default: include TOC)--heading-level: Base heading level for markdown output: 1-6 (default: 1)--css: Custom CSS to include in markdown output (default: none)--help, -h: Show help# Simple conversion (defaults to markdown format)
book2text -i book.epub
# Convert to JSON format
book2text -i book.epub -f json
# Convert to plain text
book2text -i book.epub -f text
# Custom output path
book2text -i book.epub -o ./my-output/book.md
# Clean output directory first
book2text -i book.epub -c
# Exclude metadata and table of contents
book2text -i book.epub --no-metadata --no-toc
# Customize heading levels (start at H2 instead of H1)
book2text -i book.epub --heading-level=2
# Add custom CSS (for Markdown output)
book2text -i book.epub --css="body { font-family: Arial; max-width: 800px; margin: 0 auto; }"
const { convertEbook } = require("book2text");
const run = async () => {
// Basic conversion
const result = await convertEbook({
input: "./my-book.epub",
outputFormat: "markdown", // default
outputPath: "./output/",
});
// Advanced options
const resultWithOptions = await convertEbook({
input: "./my-book.epub",
outputFormat: "json",
outputPath: "./output/",
cleanOutput: true,
includeMetadata: false,
includeToc: false,
headingLevel: 2,
customCss: "body { font-family: Arial; }",
});
if (result.success) {
console.log(`Converted to: ${result.outputFile}`);
} else {
console.error(`Error: ${result.error}`);
}
};
run();
Input Formats:
Output Formats:
MIT
FAQs
Convert ePub and MOBI files to text-based formats (JSON, Markdown, plain text)
We found that book2text demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.