Class: WinRM::FS::Core::FileUploader

Inherits:
Object
  • Object
show all
Defined in:
lib/winrm-fs/core/file_uploader.rb

Overview

Uploads the given source file to a temp file in 8k chunks

Instance Method Summary collapse

Constructor Details

#initialize(command_executor) ⇒ FileUploader

Returns a new instance of FileUploader.



24
25
26
# File 'lib/winrm-fs/core/file_uploader.rb', line 24

def initialize(command_executor)
  @command_executor = command_executor
end

Instance Method Details

#upload(local_file, remote_file) ⇒ Integer

Uploads the given file to the specified temp file as base64 encoded.

Parameters:

  • Path (String)

    to the local source file on this machine

  • Path (String)

    to the file on the target machine

Returns:

  • (Integer)

    Count of bytes uploaded



33
34
35
36
# File 'lib/winrm-fs/core/file_uploader.rb', line 33

def upload(local_file, remote_file)
  @command_executor.run_powershell(prepare_script(remote_file))
  do_upload(local_file, dos_path(remote_file))
end