I should use something like this instead. https://github.com/vesln/temporary
It detects platform and uses the appropriate temp directory. https://github.com/vesln/temporary/blob/master/lib/detector.js