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 🙏

© 2024 – Pkg Stats / Ryan Hefner

unoconv-promise-win

v1.0.7

Published

Node.js wrapper with Promise for converting documents with unoconv

Downloads

6

Readme

Unoconv Promise

npm Build Status

This is a Node.js wrapper with native Promise support for converting documents with unoconv, inspired by Graham Floyd's implementation

Setup

Requirement

Mac Only

With Homebrew

$ brew install unoconv

and in order to use unoconv, a copy of LibreOffice between versions 3.6.0.1 - 4.3.x must be installed.

Installation

$ npm install unoconv-promise

Usage

Basic

Convert document file into PDF and return as a Buffer

const unoconv = require("unoconv-promise");

unoconv
  .convert("./mydoc.doc")
  .then(fileBuffer => {
    // Converted file buffer
    return Promise.resolve(fileBuffer);
  })
  .catch(e => {
    throw e;
  });

Convert document first page to PDF and save to a file

const unoconv = require("unoconv-promise");

unoconv
  .run({
    file: "./mydoc.doc",
    output: "./temp.pdf",
    export: "PageRange=1-1"
  })
  .then(filePath => {
    console.log(filePath);
  })
  .catch(e => {
    throw e;
  });

Show supported formats

const unoconv = require("unoconv-promise");

unoconv
  .formats()
  .then(formats => {
    // formats will be an array contains supports formats
    formats.forEach(format => {
      console.log(format);
    });
  })
  .catch(e => {
    throw e;
  });
  • Each format will be look like this
{
  "format": "doc",
  "doctype": "document",
  "extension": "doc",
  "description": " Microsoft Word 97/2000/XP",
  "mime": "application/msword"
}

Unoconv.run options

Option (default) : Description

From unoconv Please check unoconv -h more details

  • connection
  • doctype
  • export
  • field
  • format(pdf): specify the output format
  • import-filter-name
  • import
  • listener
  • no-launch
  • output: output basename, filename or directory
  • password
  • pipe
  • port
  • printer
  • preserve: keep timestamp and permissions of the original document
  • server
  • show
  • stdout
  • template
  • timeout: timeout after secs if connection to listener fails
  • verbose
  • version

Extra

  • bin (unoconv): Binary command
  • string (false): Return the output as string
  • file (null): Target file

Testing

npm test
  • Coverage
npm test:coverage

Supported Formats

  • bib
  • bmp - image/bmp
  • csv - text/csv
  • dbf
  • dif
  • doc - application/msword
  • docx - application/vnd.openxmlformats-officedocument.wordprocessingml.document
  • emf - application/x-msmetafile
  • eps - application/postscript
  • fodg
  • fodp
  • fods
  • fodt
  • gif - image/gif
  • html - text/html
  • jpg - image/jpeg
  • ltx
  • met
  • odd
  • odg - application/vnd.oasis.opendocument.graphics
  • odp - application/vnd.oasis.opendocument.presentation
  • ods - application/vnd.oasis.opendocument.spreadsheet
  • odt - application/vnd.oasis.opendocument.text
  • otg - application/vnd.oasis.opendocument.graphics-template
  • otp - application/vnd.oasis.opendocument.presentation-template
  • ots - application/vnd.oasis.opendocument.spreadsheet-template
  • ott - application/vnd.oasis.opendocument.text-template
  • pbm - image/x-portable-bitmap
  • pct - image/x-pict
  • pdb - application/vnd.palm
  • pdf - application/pdf
  • pgm - image/x-portable-graymap
  • png - image/png
  • pot - application/vnd.ms-powerpoint
  • potm - application/vnd.ms-powerpoint.template.macroenabled.12
  • ppm - image/x-portable-pixmap
  • pps - application/vnd.ms-powerpoint
  • ppt - application/vnd.ms-powerpoint
  • pptx - application/vnd.openxmlformats-officedocument.presentationml.presentation
  • psw
  • pwp
  • pxl
  • ras - image/x-cmu-raster
  • rtf - application/rtf
  • sda - application/vnd.stardivision.draw
  • sdc - application/vnd.stardivision.calc
  • sdd - application/vnd.stardivision.impress
  • sdw - application/vnd.stardivision.writer
  • slk
  • stc - application/vnd.sun.xml.calc.template
  • std - application/vnd.sun.xml.draw.template
  • sti - application/vnd.sun.xml.impress.template
  • stw - application/vnd.sun.xml.writer.template
  • svg - image/svg+xml
  • svm
  • swf - application/x-shockwave-flash
  • sxc - application/vnd.sun.xml.calc
  • sxd - application/vnd.sun.xml.draw
  • sxi - application/vnd.sun.xml.impress
  • sxw - application/vnd.sun.xml.writer
  • tiff - image/tiff
  • txt - text/plain
  • uop
  • uos
  • uot
  • vor - application/vnd.stardivision.writer
  • wmf - application/x-msmetafile
  • wps - application/vnd.ms-works
  • xhtml - application/xhtml+xml
  • xls - application/vnd.ms-excel
  • xlsx - application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
  • xlt - application/vnd.ms-excel
  • xml - application/xml
  • xpm - image/x-xpixmap'

Reference