Project

Transferetto

Small PowerShell module with FTPS/SFTP functionality

Stars64
Forks15
Open issues10
PowerShell Gallery downloads12892266
Releasev1.0.0
Language: PowerShell Updated: 2026-02-14T21:19:42.0000000+00:00

Curated Examples

Stream file content over FTP

Use Transferetto to write and read remote FTP content through managed streams.

This pattern is useful when a script should work with remote content incrementally instead of forcing a whole-file upload or download step first.

It is adapted from the source example at Examples/Example22-FTPStream.ps1.

When to use this pattern

  • You want to write or read content in chunks.
  • The remote file may be inspected before downloading the whole thing.
  • A streaming workflow is more natural than a file-based workflow.

Example

Import-Module Transferetto

$ftpClient = Connect-FTP -Server 'ftp.example.com' -Credential (Get-Credential)

$writeStream = Open-FTPStream -Client $ftpClient -RemotePath '/incoming/ftp-stream-demo.txt' -Mode Write
Write-FTPStream -StreamSession $writeStream -Text "first line`n"
Write-FTPStream -StreamSession $writeStream -Text "second line`n"
Sync-FTPStream -StreamSession $writeStream
Close-FTPStream -StreamSession $writeStream

$readStream = Open-FTPStream -Client $ftpClient -RemotePath '/incoming/ftp-stream-demo.txt' -Mode Read
$chunk = Read-FTPStream -StreamSession $readStream -Count 64 -AsText
$chunk

Close-FTPStream -StreamSession $readStream
Disconnect-FTP -Client $ftpClient

What this demonstrates

  • opening a managed FTP write stream
  • syncing the remote stream explicitly before closing it
  • opening a second stream to read remote content back as text

Source