1

Generating Office docs in OpenXML. Part of the process is using zip to combine directories and files into an archive. This works fine locally

var p = 'cd ' + target + '/; zip -r ../' + this.fname + ' .; cd ..;';      
  return exec.exec(p, function(err, stdout, stderr) { ... } 

But fails on Heroku Cedar, with an error /bin/sh: zip: not found. Logging in via shell (heroku run bash) and running ls /bin, it appears that the zip binary does not exist. gzip does exist, but I think that's different.

Is it possible to run zip on the Heroku from a shell process? From this link below it seems like it should be possible. (That article uses Ruby, I use Node, but I think the shell shouldn't care who's calling it?)

Rails: How can I use system zip on Heroku to make a docx from an xml template?

Community
  • 1
  • 1
prototype
  • 7,249
  • 15
  • 60
  • 94

1 Answers1

1

It says here

How to unzip files in a Heroku Buildpack

that though heroku doesn't include the zip command, the jar command is available.

However, why not use an npm like this one to process your files from within the node app itself:

https://www.npmjs.org/package/zipfile

Community
  • 1
  • 1
Robert Moskal
  • 21,737
  • 8
  • 62
  • 86
  • Aha, didn't realize ZIP was exactly equal to Jar for purpose of MSOffice. For now made minimal incision by replacing `zip -r ...` with `jar -cfM ...` and that works locally and on heroku. – prototype Dec 08 '14 at 20:51
  • Yup a jar is just a zip file. Glad to be of help. – Robert Moskal Dec 08 '14 at 20:52