Sha256: 42e76411a8deb2314832146950ca1c807d35a297ea7efe2aaf9b6b73dbbaa747

Contents?: true

Size: 619 Bytes

Versions: 6

Compression:

Stored size: 619 Bytes

Contents

require_relative 'command_handler'

module Ftpd

  class CmdSize < CommandHandler

    def cmd_size(path)
      ensure_logged_in
      ensure_file_system_supports :read
      syntax_error unless path
      path = File.expand_path(path, name_prefix)
      ensure_accessible(path)
      ensure_exists(path)
      file_system.read(path) do |file|
        if data_type == 'A'
          output = StringIO.new
          io = Ftpd::Stream.new(output, data_type)
          io.write(file)
          size = output.size
        else
          size = file.size
        end
        reply "213 #{size}"
      end
    end

  end

end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
ftpd-1.1.1 lib/ftpd/cmd_size.rb
ftpd-1.1.0 lib/ftpd/cmd_size.rb
investtools-ftpd-1.0.1 lib/ftpd/cmd_size.rb
ftpd-1.0.1 lib/ftpd/cmd_size.rb
ftpd-1.0.0 lib/ftpd/cmd_size.rb
ftpd-0.17.0 lib/ftpd/cmd_size.rb