Skip to content

moteus/lua-lluv-ftp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lluv-ftp - FTP client for lluv library

Licence Build Status Coverage Status

Usage

  local FTP = requrie "lluv.ftp"

  local ftp = FTP.Connection.new(server, {uid = user, pwd = pass})
  ftp:open(function(self, err)

  -- Upload file data from string
  ftp:stor('test.txt', 'hello world', function(self, err) ... end)

  -- Download file with offset and get result as string
  ftp:retr('test.txt', {type = "i", rest = 5}, function(self, err, code, data)
    -- here data is array of file parts
    data = table.concat(data)
  end

  -- Upload data from ltn12 source
  ftp:stor('test.txt', {source = ltn12.source.string('hello world')}, function(self, err) ... end)

  -- Download file to ltn12 sink
  local t = {}
  ftp:retr('test.txt', {sink = ltn12.sink.table(t)}, function(self, err, code, data)
    local data = table.concat(t)
  end