我正在尝试处理Google Cloud Functions上的PDF。但我认为它错过了一个包pdftotext
。我怎样才能解决这个问题?
我有:
const extract = require('pdf-text-extract')
...
const gcsBucket = gcs.bucket(bucket)
const tempFilePath = path.join(os.tmpdir(), path.basename(name))
return gcsBucket.file(name).download({
destination: tempFilePath
})
.then(() => {
return new Promise((resolve, reject) => {
extract(tempFilePath, (err, pages) => {
if (err) return reject(err) // I think it fails here
return resolve(pages)
})
})
})
我得到了
Error: spawn pdftotext ENOENT
at exports._errnoException (util.js:1020:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:197:32)
at onErrorNT (internal/child_process.js:376:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickDomainCallback (internal/process/next_tick.js:128:9)