atinux / node-ftps

FTP, FTPS and SFTP client for node.js, mainly a lftp wrapper.
MIT License
202 stars 57 forks source link

Can I create a file over the fly ? #57

Open omkartin opened 7 years ago

omkartin commented 7 years ago

I have dynamic data to be uploaded with custom file name. I would like to create a binary buffer, create a file and load the buffer into the file and then sftp the file.

Please see the following code which uploads a custom file.

let chargesString = 'CHARGES'; let chargesFileName = 'charges.txt'; let buffer = new Buffer(chargesString, 'binary'); Ftp.put(buffer, chargesFileName, function(hadError) { console.log('Entering'); if (!hadError){ console.log("Charges File transferred successfully!"); } else { console.error('There was an error uploading the Charges file.', hadError); } }); The above code is feasible with ftp which doesnt do sftp.

Is this possible here? If not can you please add that feature.