All Projects → regis-leray → fs2-ftp

regis-leray / fs2-ftp

Licence: Apache-2.0 License
Simple client for Ftp/Ftps/Sftp

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to fs2-ftp

proftpd-mod proxy
FTP proxy support for ProFTPD
Stars: ✭ 35 (+45.83%)
Mutual labels:  ftp, sftp, ftps
core-nodejs
⚡ An FTP/FTPS/SFTP client with modern API.
Stars: ✭ 37 (+54.17%)
Mutual labels:  ftp, sftp, ftps
Winscp
WinSCP is a popular free SFTP and FTP client for Windows, a powerful file manager that will improve your productivity. It supports also Amazon S3, FTPS, SCP and WebDAV protocols. Power users can automate WinSCP using .NET assembly.
Stars: ✭ 794 (+3208.33%)
Mutual labels:  ftp, sftp, ftp-client
pfps-examples
🏮 Standalone examples shown in the book "Practical FP in Scala: A hands-on approach"
Stars: ✭ 167 (+595.83%)
Mutual labels:  cats, fs2, cats-effect
publish-sftp
One-line command to quickly publish resources to a specified server
Stars: ✭ 41 (+70.83%)
Mutual labels:  ftp, sftp, ftp-client
Filestash
🦄 A modern web client for SFTP, S3, FTP, WebDAV, Git, Minio, LDAP, CalDAV, CardDAV, Mysql, Backblaze, ...
Stars: ✭ 5,231 (+21695.83%)
Mutual labels:  ftp, sftp, ftp-client
Whipftp
OpenSource FTP / SFTP client
Stars: ✭ 158 (+558.33%)
Mutual labels:  ftp, sftp, ftp-client
Fluentftp
An FTP and FTPS client for .NET & .NET Standard, optimized for speed. Provides extensive FTP commands, File uploads/downloads, SSL/TLS connections, Automatic directory listing parsing, File hashing/checksums, File permissions/CHMOD, FTP proxies, FXP support, UTF-8 support, Async/await support, Powershell support and more. Written entirely in C#,…
Stars: ✭ 1,943 (+7995.83%)
Mutual labels:  ftp, ftp-client, ftps
gftp
gFTP is a free multithreaded file transfer client for *NIX based machines. 56 language translations available.
Stars: ✭ 81 (+237.5%)
Mutual labels:  ftp, sftp, ftps
php-ftp-client
📦 Provides helper classes and methods to manage FTP files in an OOP way.
Stars: ✭ 81 (+237.5%)
Mutual labels:  ftp, ftp-client, ftps
Transferetto
Small PowerShell module with FTPS/SFTP functionality
Stars: ✭ 33 (+37.5%)
Mutual labels:  ftp, sftp, ftps
tutorials
🎥 Source code of the examples shown in the video tutorials
Stars: ✭ 18 (-25%)
Mutual labels:  cats, fs2, cats-effect
swam
WebAssembly engine in Scala
Stars: ✭ 38 (+58.33%)
Mutual labels:  cats, fs2, cats-effect
typelevel-stack.g8
📚 Unofficial Giter8 template for the Typelevel Stack (Http4s / Doobie / Circe / Cats Effect / Fs2) based on Cats v1.x.x
Stars: ✭ 63 (+162.5%)
Mutual labels:  cats, fs2, cats-effect
scala-functional-programming-tutorial
Functional Programming in Scala Tutorial
Stars: ✭ 23 (-4.17%)
Mutual labels:  cats, fs2, cats-effect
tradeio
A disciplined way to purely functional domain models in Scala
Stars: ✭ 19 (-20.83%)
Mutual labels:  cats, cats-effect
meteor
https://d2a4u.github.io/meteor/
Stars: ✭ 17 (-29.17%)
Mutual labels:  fs2, cats-effect
fs2-es
Event sourcing utilities for FS2
Stars: ✭ 75 (+212.5%)
Mutual labels:  fs2, cats-effect
autoscreen
Automated screen capture utility
Stars: ✭ 76 (+216.67%)
Mutual labels:  ftp, sftp
ftpConnect
A simple and robust dart FTP Client Library to interact with FTP Servers with possibility of zip and unzip files.
Stars: ✭ 43 (+79.17%)
Mutual labels:  ftp, ftp-client

FS2 with SFTP - FTP / FTPS

fs2 ftp client built on top of Cats Effect, Fs2 and the sftp java client sshj and ftp/ftps client commons-net

Build Status codecov Maven Central Cats friendly

Setup

// Supports scala versions (2.12 / 2.13 / 3.1.x)

libraryDependencies += "com.github.regis-leray" %% "fs2-ftp" % "<version>"

How to use it ?

FTP / FTPS

import cats.effect.IO
import fs2.ftp.UnsecureFtp._
import fs2.ftp.FtpSettings._

// FTP
val settings = UnsecureFtpSettings("127.0.0.1", 21, FtpCredentials("foo", "bar"))
// FTP-SSL 
val settings = UnsecureFtpSettings.ssl("127.0.0.1", 21, FtpCredentials("foo", "bar"))

connect[IO](settings).use{
  _.ls("/").compile.toList
}

SFTP

Password authentication

import fs2.ftp.SecureFtp._
import fs2.ftp.FtpSettings._
import cats.effect.IO

val settings = SecureFtpSettings("127.0.0.1", 22, FtpCredentials("foo", "bar"))

connect[IO](settings).use(
  _.ls("/").compile.toList
)     

private key authentication

import fs2.ftp.SecureFtp._
import fs2.ftp.FtpSettings._
import java.nio.file.Paths._
import cats.effect.IO

// Provide a SftpIdentity implementation

val keyFile = KeyFileSftpIdentity(Paths.get("privateKeyStringPath"))

val settings = SecureFtpSettings("127.0.0.1", 22, FtpCredentials("foo", ""), keyFile)

connect[IO](settings).use(
  _.ls("/").compile.toList
)     

Required Runtime

Since all (s)ftp command are IO bound task , it needs to be executed on specific runtime. More information about IO and Cats Effect can be found here https://typelevel.org/cats-effect/docs/tutorial

The following example show how to create a FtpClient[F[_], +A] by using connect()

  • Here the runtime is provided by IOApp.Simple
import cats.effect.{IO, IOApp}
import fs2.ftp.FtpSettings._

object MyApp extends IOApp.Simple {
  //F[_] Effect will be set as cats.effect.IO

  private val settings = SecureFtpSettings("127.0.0.1", 22, FtpCredentials("foo", "bar"))

  //print all files/directories
  def run: IO[Unit] = {
    connect[IO, SecureFtp.Client](settings).use {
      _.ls("/mypath")
        .evalTap(r => IO(println(r)))
        .compile
        .drain
    }
  }
}

Support any commands ?

The underlying client is safely exposed and you have access to all possible ftp commands

import cats.effect.IO
import fs2.ftp.SecureFtp._
import fs2.ftp.FtpSettings._

val settings = SecureFtpSettings("127.0.0.1", 22, FtpCredentials("foo", "bar"))

connect[IO](settings).use(
  _.execute(_.version())
)     

Support any effect (IO, Monix, ZIO)

Since the library support polymorphic in the effect type F[_] (as long as it is compatible with cats-effect typeclasses), fs2-ftp can be used with other effect libraries such as Monix / ZIO.

The library is by default bringing with cats-effect dependency as the default effect system implementation.

exemple for monix

You will need to use add in build.sbt monix-eval

libraryDependencies += "io.monix" %% "monix-eval" % "<version>"
import fs2.ftp.FtpSettings._
import fs2.ftp._
import monix.eval.Task
import monix.execution.Scheduler.Implicits.global
import Task.contextShift

val settings = SecureFtpSettings("127.0.0.1", 22, FtpCredentials("foo", "bar"))

val _: monix.Task[List[FtpResource]] = connect(settings).use {
  _.ls("/").compile.toList
}

exemple for zio

You will need to use add in build.sbt zio-cats-interop

libraryDependencies += "dev.zio" %% "zio-interop-cats" % "<version>"
import fs2.ftp.FtpSettings._
import zio.interop.catz._
import zio.ZIO

val settings = SecureFtpSettings("127.0.0.1", 22, FtpCredentials("foo", "bar"))

ZIO.runtime.map { implicit r: zio.Runtime[Any] =>
  implicit val CE: ConcurrentEffect[zio.Task] = implicitly
  implicit val CS: ContextShift[zio.Task] = implicitly

  val _: zio.Task[List[FtpResource]] = connect(settings).use {
    _.ls("/").compile.toList
  }
}

How to release

  1. How to create a key to signed artifact
# generate key
$ gpg --gen-key

# list the keys
$ gpg --list-keys

/home/foo/.gnupg/pubring.gpg
------------------------------

pub   rsa4096 2018-08-22 [SC]
      1234517530FB96F147C6A146A326F592D39AAAAA
uid           [ultimate] your name <[email protected]>
sub   rsa4096 2018-08-22 [E]

#send key to server
$> gpg --keyserver keyserver.ubuntu.com --send-keys $LONG_ID

# declare in travis (settings) PGP_SECRET in base64 (with no return carriage), dont put "" around the value !
gpg --armor --export-secret-keys $LONG_ID | base64 -w0 | pbcopy

# declare in travis (settings) PGP_PASSPHRASE in plain text
The randomly generated password you used to create a fresh gpg key
  1. create a tag and push

more information here => https://github.com/olafurpg/sbt-ci-release

LICENSE

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].