module Net::SCP::Download
def download_start_state(channel)
readiness to proceed. Then, the state machine is placed into the
and scaffolding and then sends a 0-byte to the remote server, indicating
time the channel is processed. This state does some basic error checking
#start_command method puts the state machine into this state the first
This is the starting state for the download state machine. The
def download_start_state(channel) if channel[:local].respond_to?(:write) && channel[:options][:recursive] raise Net::SCP::Error, "cannot recursively download to an in-memory location" elsif channel[:local].respond_to?(:write) && channel[:options][:preserve] lwarn { ":preserve option is ignored when downloading to an in-memory buffer" } channel[:options].delete(:preserve) elsif channel[:options][:recursive] && !File.exist?(channel[:local]) Dir.mkdir(channel[:local]) end channel.send_data("\0") channel[:state] = :read_directive end