headDocument static method
Future<DocumentFrameResponse>
headDocument(
- P2PStream stream, {
- required PeerId ownerPeerId,
- required String path,
Head a document (client-side)
Implementation
static Future<DocumentFrameResponse> headDocument(
P2PStream stream, {
required PeerId ownerPeerId,
required String path,
}) async {
try {
final requestBytes = DocumentFrame.encodeRequest(
operation: 'HEAD',
ownerPeerId: ownerPeerId,
path: path,
);
await _writeFrameStatic(stream, requestBytes);
// Read response
final responseBytes = await _readFrameStatic(stream);
return DocumentFrame.decodeResponse(responseBytes);
} catch (e, stackTrace) {
_logger.severe('Error heading document: $e', e, stackTrace);
rethrow;
}
}