index.js
function streamResultsPromise (command, args, options, cb) {
    var output = ''
    var stderr = ''
    var child = spawn(command, args, options)
    child.stdout.setEncoding('utf8')
    child.stderr.setEncoding('utf8')
    child.stdout.on('data', stdoutHandler)
    child.stderr.on('data', stderrHandler)
    child.on('close', closeHandler)

    function stdoutHandler (data) {
      output += data
    }

    function stderrHandler (data) {
      stderr += data
    }

    function closeHandler (code) {
      if (code !== 0) {
        var ex = new Error('pdf-text-extract command failed: ' + stderr)
        throw ex
      }
      cb(output)
    }
  }
function streamResultsPromise (command, args, options, cb) {
    var output = ''
    var stderr = ''
    var child = spawn(command, args, options)
    child.stdout.setEncoding('utf8')
    child.stderr.setEncoding('utf8')
    child.stdout.on('data', stdoutHandler)
    child.stderr.on('data', stderrHandler)
    child.on('close', closeHandler)

    function stdoutHandler (data) {
      output += data
    }

    function stderrHandler (data) {
      stderr += data
    }

    function closeHandler (code) {
      if (code !== 0) {
        var ex = new Error('pdf-text-extract command failed: ' + stderr)
        throw ex
      }
      cb(output)
    }
  }
function streamResultsPromise ( command , args , options , cb ) { var output = '' var stderr = '' var child = spawn ( command , args , options ) child . stdout . setEncoding ( 'utf8' ) child . stderr . setEncoding ( 'utf8' ) child . stdout . on ( 'data' , stdoutHandler ) child . stderr . on ( 'data' , stderrHandler ) child . on ( 'close' , closeHandler ) function stdoutHandler ( data ) { output += data } function stderrHandler ( data ) { stderr += data } function closeHandler ( code ) { if ( code !== 0 ) { var ex = new Error ( 'pdf-text-extract command failed: ' + stderr ) throw ex } cb ( output ) } }
Duplicated from function splitPages of streamResults
Duplicated from function splitPages of streamResults