andris9/pem — pull request #11 by apatil (2014-01-29 01:18:35+00:00)
Title: Easier to set temp dir, and all temp files are unlinked after use

Hi Andris, thanks for 'pem'. I noticed that the existing fs.unlink at the end of each openssl call wasn't actually doing anything. This PR makes it so all the temp files actually get removed.

I also added an environment variable, PEMJS_TMPDIR, that lets you set a separate temp directory for pem from the global node.js one. That makes it easier for people to use things like tmpfs mounts to reduce concurrent disk writes, enfcs mounts for extra security, etc.

I considered using [https://npmjs.org/package/shredfile](shredfile) in place of unlink, but didn't because a) using tmpfs makes more sense for me, and b) I'm not sure about shredfile's Windows compatibility.

Cheers,
Anand