Upload to FTP via a Memory Stream without creating any files
Although the
It is an unavoidable and key requirement for me that no files are created on the file system when uploading to the FTP/SFTP server. The contents that I'm uploading are generated on the fly, and must not be stored on disk.
Is this at all possible using WinSCP?
Sample code:
The file is uploaded successfully, but I can see that the .csv file is created on the machine after running this code.
Please note that simply deleting the file after-the-fact isn't an acceptable solution. The file must not be saved locally at all.
Thanks in advance for any assistance you can provide.
Session.PutFile
method allows uploading a file from a stream, it seems that it creates a file behind the scenes.
It is an unavoidable and key requirement for me that no files are created on the file system when uploading to the FTP/SFTP server. The contents that I'm uploading are generated on the fly, and must not be stored on disk.
Is this at all possible using WinSCP?
Sample code:
$stream = [IO.MemoryStream]::new([Text.Encoding]::UTF8.GetBytes($queryFile.content)) $transfer = New-WinSCPTransferOption -OverwriteMode Overwrite $session.PutFile($stream, "./somedirectory/$($queryFile.fileName).csv", $transfer)
Please note that simply deleting the file after-the-fact isn't an acceptable solution. The file must not be saved locally at all.
Thanks in advance for any assistance you can provide.