Reputation: 11532
How to create temporary file and put content inside and send to remote machine and delete after that.I have function which send file with scp to remote but how to create temp file and put content inside ?I looked at temp module for node.js but how to put content inside ?
Upvotes: 3
Views: 6622
Reputation: 2221
There is a complete example on the node-temp website:
https://github.com/bruce/node-temp
var temp = require('temp');
// Automatically track and cleanup files at exit
temp.track();
var stream = temp.createWriteStream();
stream.write("Some data");
// Maybe do some other things
stream.end();
Upvotes: 8