Skip to content

NodeJS lib that wraps cli execution of gs (ghsotscript).

Notifications You must be signed in to change notification settings

sina-masnadi/node-gs

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-gs

NodeJS wrapper for GhostScript with the ability to set executable path in order to use with services like AWS Lambda.

Installation

npm install https://github.com/sina-masnadi/node-gs/tarball/master

or

"dependencies": {
    "gs": "https://github.com/sina-masnadi/node-gs/tarball/master"
}

Usage

To set the executable path you can use: executablePath('ghostscript/bin/./gs')

A compiled version of GhostScript (v9.20) for AWS Lambda can be find here: https://github.com/sina-masnadi/lambda-ghostscript

Sample usage:

var gs = require('gs');
gs()
    .batch()
    .nopause()
    .option('-r' + 50 * 2)
    .option('-dDownScaleFactor=2')
    .executablePath('ghostscript/bin/./gs')
    .device('png16m')
    .output('/tmp/' + fileName + '-%d.png')
    .input('/tmp/' + fileName)
    .exec(function (err, stdout, stderr) {
        if (!err) {
           // no error
        } else {
           // handle errors
        }
    });

API

  • batch
  • nopause
  • device - device - defaults to txtwrite
  • output - file - defaults to - which represents stdout
  • option - you can add any options that is not provided through the functions to the command
  • input - file
  • executablePath - path to the Ghostscript executable files (example: ghostscript/bin/./). This can be useful for Lambda functions.
  • exec - callback

License

MIT - http://ncb000gt.mit-license.org/

About

NodeJS lib that wraps cli execution of gs (ghsotscript).

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 98.8%
  • Makefile 1.2%