create file in user's temp folder

Posted by user2867494 on Stack Overflow See other posts from Stack Overflow or by user2867494
Published on 2013-10-24T15:50:44Z Indexed on 2013/10/24 15:53 UTC
Read the original article Hit count: 216

Filed under:
|

I am using the following code to try and create a file in the user's temp folder, but it will not.

    var fs = require('fs');
    var os = require('os');
    var ostemp = os.tmpdir();
    var exec = require('child_process').exec;
    var file = fs.createWriteStream(ostemp + '\setup.exe');

ostemp will return a path similar to 'c:\users\user\appdata\local\temp'

But the code above will save the file to local, and the filename will be tempsetup.exe

Why is that?

© Stack Overflow or respective owner

Related posts about node.js

Related posts about node-webkit