Coder Social home page Coder Social logo

node-gs's Introduction

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/

node-gs's People

Contributors

ecarter avatar ncb000gt avatar sina-masnadi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.