'Upload byte array without actually creating a local file to SFTP server using WinSCP .NET assembly?

I need to write a PowerShell script that reads some data and writes it to a file on a remote SFTP location. I'd rather not generate a local file first before initiating the SFTP session. Can WinSCP work with a byte array to send to the remote folder?



Solution 1:[1]

Use Session.PutFile method (available since WinSCP 5.19).


For a similar question (just for a download), see:
Access remote file contents as a stream using WinSCP .NET assembly.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1