Socket
Book a DemoInstallSign in
Socket

node-convert

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-convert

NodeJS office converter using LibreOffice or OpenOffice.

0.1.1
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

node-office

NodeJS file converter using LibreOffice or OpenOffice software under the hood.

  • Convert PDF, Office and many other file types (supported file formats)
  • Generate file thumbnails
  • Callback and promise support
  • Output to file or buffer

Installation

npm install --save node-office

// or

yarn add node-office

Usage

Convert files

Convert a single DOC to PDF

await office.convert('./test.doc', './test.pdf');

Convert a single file with callback function

function callback() {
  console.log('Done!');
}

office.convert('./test.doc', './test.pdf', callback);

Output to buffer

const buffer = await office.convert('./test.doc');

Generate thumbnails

Thumbnails can be generated by converting a file to an image format like JPEG or PNG.

Generate a thumbnail for a single file

await office.convert('./test.doc', './test.jpg');
await office.convert('./marketing.pdf', './marketing.jpg');

Different ways to import node-office

ES6 Import syntax

import office from 'node-office';

await office.convert('./test.doc', './test.pdf');
import { convert, listen } from 'node-office';

await convert('./test.doc', './test.pdf');

CommonJS require syntax

const office = require('node-office');

function cb() {
  console.log('Conversion complete');
}

office.convert('./test.doc', './test.pdf', cb);
const convert = require('node-office').convert;

function cb() {
  console.log('Conversion complete');
}

convert('./test.doc', './test.pdf', cb);

Keywords

office

FAQs

Package last updated on 11 Jun 2022

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.