No description
Find a file
Mohd Yahiya Khan 34ba42c1cb
Merge pull request #1 from Sandy10247/sandy/code-refactor
minor code changes & README.md cleanup
2026-02-17 16:59:32 +05:30
go.mod minor code changes + README.md cleanup 2026-02-15 18:52:52 +05:30
go.sum initial commit 2026-02-14 20:24:05 +05:30
main.go minor code changes + README.md cleanup 2026-02-15 18:52:52 +05:30
main_test.go updated main_test 2026-02-15 19:04:56 +05:30
README.md minor code changes + README.md cleanup 2026-02-15 18:52:52 +05:30

SFTP Pipeline

A high-performance Go library for parallel SFTP file transfers with concurrent reading and processing capabilities.

Features

  • Parallel SFTP Reads: Configurable number of concurrent SFTP connections for reading files
  • Concurrent Processing: Process downloaded files with multiple worker goroutines
  • Buffered Pipeline: Configurable buffer size between read and processing stages
  • Error Handling: Tracks failed transfers separately from successful ones
  • Performance Metrics: Reports transfer time and success/failure statistics

Installation

go get github.com/MYK12397/sftp-pipeline

Usage

Basic Examples

 // Write to local disk
 TransferFiles(sftpClient, jobs, func(r FileResult) error{
     return os.WriteFile("/data/"+r.ID, r.Data, 0644)
 })

//upload to cloud storage
TransferFiles(sftpClient, jobs, func(r FileResult) error{
     return cloudClient.Upload(r.ID, r.Data)
 })

TransferFiles(sftpClient, jobs, func(r FileResult) error{
     text := extractText(r.Data)
     return cloudClient.Upload(r.ID, r.Data)
 })

Configuration

The PipelineCfg struct controls the pipeline behavior:

  • SFTPRreaders: Number of goroutines reading from SFTP (default: 80)
  • Workers: Number of goroutines processing files (default: 10)
  • BufferSize: Channel buffer size (default: 10)