Sha256: 90f724f0a1fc5a40f47a6c36c5dc8f51940ec68fdf0b89f64c31a26d91430ba1
Contents?: true
Size: 724 Bytes
Versions: 2
Compression:
Stored size: 724 Bytes
Contents
class PgExport class FtpService CHUNK_SIZE = (2**16).freeze def initialize(params) @host = params.fetch(:host) connection = Connection.new(params) @ftp = connection.ftp ObjectSpace.define_finalizer(self, proc { connection.close }) end def list(regex_string) ftp.list(regex_string).map { |item| item.split(' ').last }.sort.reverse end def delete(filename) ftp.delete(filename) end def upload_file(path, name) ftp.putbinaryfile(path.to_s, name, CHUNK_SIZE) end def download_file(path, name) ftp.getbinaryfile(name, path.to_s, CHUNK_SIZE) end def to_s host end private attr_reader :ftp, :host end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pg_export-0.4.1 | lib/pg_export/services/ftp_service.rb |
pg_export-0.4.0 | lib/pg_export/services/ftp_service.rb |