statvfs method
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:
- SftpClient.statvfs which takes a path instead of a file handle as argument.
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);
}