open method

Future<SftpFile> open(
  1. String path, {
  2. SftpFileOpenMode mode = SftpFileOpenMode.read,
})

Opens a file for reading or/and writing.

Implementation

Future<SftpFile> open(
  String path, {
  SftpFileOpenMode mode = SftpFileOpenMode.read,
}) async {
  final reply = await _sendOpen(path, mode, SftpFileAttrs());
  if (reply is SftpHandlePacket) return SftpFile(this, reply.handle);
  if (reply is! SftpStatusPacket) throw SftpError('Unexpected reply');
  throw SftpStatusError.fromStatus(reply);
}