npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

file-converter-nodejs

v1.0.4

Published

A powerful Node.js package for converting files between various formats, splitting and merging files, and automating complex file operations. Backed by LibreOffice and Python, this tool makes file processing seamless for developers.

Readme

📄 file-converter-nodejs

A powerful Node.js package for converting files between various formats, splitting and merging files, and automating complex file operations. Backed by LibreOffice and Python, this tool makes file processing seamless for developers.

Useful link:


✨ Features

  • Format Conversions
    Convert files between formats with ease:

    • PDF ➡️ PPTX, PNG, JPG, HTML, DOCX
    • PPTX ➡️ PDF, HTML, PNG, JPG
    • PNG ➡️ PDF, JPG, SVG
    • JPG ➡️ PDF, PNG, SVG
    • SVG ➡️ PDF, PNG, JPG
    • XLSX ➡️ PDF, CSV, HTML
    • CSV ➡️ XLSX, PDF, HTML
  • Advanced Pipelines
    Multi-step processing like splitting PDFs into pages, converting them, and merging results into a single file.

  • Splitting Files
    Split large PDFs and PPTX files into smaller components.

  • Merging Files
    Merge multiple PDFs, DOCX, or PPTX files into one.

  • 🚀 Pre-built Docker Image
    Use the provided Docker image with all dependencies pre-installed.


📦 Installation

1. Install Using Yarn or NPM

# With Yarn
yarn add file-converter-nodejs

# With NPM
npm install file-converter-nodejs

2. Install Dependencies

This package requires LibreOffice and Python to be installed on your system. You can install them via your package manager or use the provided Docker image:

Using Docker (Recommended)

docker pull azertyha77/nodejs-python-soffice:latest

Your Dockerfile could look like this:

FROM azertyha77/nodejs-python-soffice:latest

WORKDIR /app

COPY . .

RUN npm install

CMD ["node", "index.js"]

Or check example Dockerfile for a more accurate example.

Without Docker

You will need to install the following dependencies manually:

  • LibreOffice
    Install LibreOffice on your system.
    Download LibreOffice

  • Python Install Python on your system.

  • Python dependencies
    Install the required Python dependencies using pip (find them in requirements.txt):

    pip install -r requirements.txt

    or if you already have the npm package installed:

    pip install -r node_modules/file-converter-nodejs/requirements.txt

You can have a look at an example of how to install each dependency in this Dockerfile.


🛠️ Usage

Initialize the Processor

import FileProcessor from "file-converter-nodejs";

const processor = new FileProcessor();

🔄 File Conversion

📄 Convert PDF to DOCX:

await processor.convertFile({
  filePath: "/path/to/input.pdf",
  from: "pdf",
  to: "docx",
  outdir: "/path/to/output",
});

📄 Convert PDF to PPTX:

await processor.convertFile({
  filePath: "/path/to/input.pdf",
  from: "pdf",
  to: "pptx",
  outdir: "/path/to/output",
});

📄 Convert PDF to PNG:

await processor.convertFile({
  filePath: "/path/to/input.pdf",
  from: "pdf",
  to: "png",
  outdir: "/path/to/output",
});

📄 Convert PDF to JPG:

await processor.convertFile({
  filePath: "/path/to/input.pdf",
  from: "pdf",
  to: "jpg",
  outdir: "/path/to/output",
});

📄 Convert PDF to HTML:

await processor.convertFile({
  filePath: "/path/to/input.pdf",
  from: "pdf",
  to: "html",
  outdir: "/path/to/output",
});

📄 Convert PDF to DOCX:

await processor.convertFile({
  filePath: "/path/to/input.pdf",
  from: "pdf",
  to: "docx",
  outdir: "/path/to/output",
});

📊 Convert PPTX to PDF:

await processor.convertFile({
  filePath: "/path/to/input.pptx",
  from: "pptx",
  to: "pdf",
  outdir: "/path/to/output",
});

📊 Convert PPTX to HTML:

await processor.convertFile({
  filePath: "/path/to/input.pptx",
  from: "pptx",
  to: "html",
  outdir: "/path/to/output",
});

📊 Convert PPTX to PNG:

await processor.convertFile({
  filePath: "/path/to/input.pptx",
  from: "pptx",
  to: "png",
  outdir: "/path/to/output",
});

📊 Convert PPTX to JPG:

await processor.convertFile({
  filePath: "/path/to/input.pptx",
  from: "pptx",
  to: "jpg",
  outdir: "/path/to/output",
});

🖼️ Convert PNG to PDF:

await processor.convertFile({
  filePath: "/path/to/input.png",
  from: "png",
  to: "pdf",
  outdir: "/path/to/output",
});

🖼️ Convert PNG to JPG:

await processor.convertFile({
  filePath: "/path/to/input.png",
  from: "png",
  to: "jpg",
  outdir: "/path/to/output",
});

🖼️ Convert PNG to SVG:

await processor.convertFile({
  filePath: "/path/to/input.png",
  from: "png",
  to: "svg",
  outdir: "/path/to/output",
});

🖼️ Convert JPG to PDF:

await processor.convertFile({
  filePath: "/path/to/input.jpg",
  from: "jpg",
  to: "pdf",
  outdir: "/path/to/output",
});

🖼️ Convert JPG to PNG:

await processor.convertFile({
  filePath: "/path/to/input.jpg",
  from: "jpg",
  to: "png",
  outdir: "/path/to/output",
});

🖼️ Convert JPG to SVG:

await processor.convertFile({
  filePath: "/path/to/input.jpg",
  from: "jpg",
  to: "svg",
  outdir: "/path/to/output",
});

🖼️ Convert SVG to PDF:

await processor.convertFile({
  filePath: "/path/to/input.svg",
  from: "svg",
  to: "pdf",
  outdir: "/path/to/output",
});

🖼️ Convert SVG to PNG:

await processor.convertFile({
  filePath: "/path/to/input.svg",
  from: "svg",
  to: "png",
  outdir: "/path/to/output",
});

🖼️ Convert SVG to JPG:

await processor.convertFile({
  filePath: "/path/to/input.svg",
  from: "svg",
  to: "jpg",
  outdir: "/path/to/output",
});

📊 Convert XLSX to PDF:

await processor.convertFile({
  filePath: '/path/to/input.xlsx',
  from: 'xlsx',
  to: 'pdf',
  outdir: '/path/to/output',
});

📊 Convert XLSX to CSV:

await processor.convertFile({
  filePath: "/path/to/input.xlsx",
  from: "xlsx",
  to: "csv",
  outdir: "/path/to/output",
});

📊 Convert XLSX to HTML:

await processor.convertFile({
  filePath: "/path/to/input.xlsx",
  from: "xlsx",
  to: "html",
  outdir: "/path/to/output",
});

📝 Convert CSV to XLSX:

await processor.convertFile({
  filePath: "/path/to/input.csv",
  from: "csv",
  to: "xlsx",
  outdir: "/path/to/output",
});

📝 Convert CSV to PDF:

await processor.convertFile({
  filePath: "/path/to/input.csv",
  from: "csv",
  to: "pdf",
  outdir: "/path/to/output",
});

📝 Convert CSV to HTML:

await processor.convertFile({
  filePath: "/path/to/input.csv",
  from: "csv",
  to: "html",
  outdir: "/path/to/output",
});

🔄 Splitting and Merging Files

📄 Split PDF into Pages:

const splitFiles = processor.splitFile({
  filePath: "/path/to/input.pdf",
  fileType: "pdf",
  outputDir: "/path/to/output",
});

console.log("Generated Files:", splitFiles);

📄 Split PPTX into Pages:

const splitSlides = processor.splitFile({
  filePath: "/path/to/input.pptx",
  fileType: "pptx",
  outputDir: "/path/to/output",
});

console.log("Generated Files:", splitSlides);

📄 Merge PDF Files:

processor.mergeFiles({
  filePaths: ["/path/to/file1.pdf", "/path/to/file2.pdf"],
  fileType: "pdf",
  outputFilePath: "/path/to/merged.pdf",
});

📄 Merge PPTX Files:

processor.mergeFiles({
  filePaths: ["/path/to/file1.pptx", "/path/to/file2.pptx"],
  fileType: "pptx",
  outputFilePath: "/path/to/merged.pptx",
});

📄 Merge DOCX Files:

processor.mergeFiles({
  filePaths: ["/path/to/file1.docx", "/path/to/file2.docx"],
  fileType: "docx",
  outputFilePath: "/path/to/merged.docx",
});

⚙️ Configuration

Default Settings

  • LibreOffice Path soffice
  • Python Path python3

You can customize the configuration by passing options to the FileProcessor constructor:

const processor = new FileProcessor({
  libreOfficePath: "/custom/path/to/soffice",
  pythonPath: "/custom/path/to/python",
});

Note that if you're using the provided docker image, you don't need to pass these options.


🤝 Contribution

Contributions are welcome! Please open an issue or submit a pull request for any improvements or feature requests.


📝 License

This project is licensed under the MIT License. See the LICENSE file for more information.