statvfs method

Future<SftpStatVfs> statvfs()

Gets filesystem statistics that this file is on.

Note: This is an extension to the SFTP protocol, supported by most openssh servers. A SftpExtensionError is thrown if the server does not support this extension.

See also:

Implementation

Future<SftpStatVfs> statvfs() async {
  _mustNotBeClosed();
  await _client._checkExtension('fstatvfs@openssh.com', '2');
  final payload = SftpFstatVfsRequest(handle: _handle);
  final reply = await _client._sendExtended(payload);
  if (reply is SftpStatusPacket) throw SftpStatusError.fromStatus(reply);
  if (reply is! SftpExtendedReplyPacket) throw SftpError('Unexpected reply');
  final stat = SftpStatVfsReply.decode(reply.payload);
  return SftpStatVfs.fromReply(stat);
}