Generated from services/crossfire/node/packages/contracts/src/rest/binary.ts at
52bf0279Definitions#
These TypeScript definitions document server validation. check.object rejects unknown fields. Custom functions and refinements specify additional checks.
Imported definitions#
services/crossfire/node/packages/kernel/src/result.tsservices/crossfire/node/packages/kernel/src/bytes.ts
binaryInput#
export function binaryInput(value: unknown): Result<BinaryInput> {
if (!value || typeof value !== 'object' || !('byteLength' in value) || !('chunks' in value)
|| typeof value.byteLength !== 'number' || !Number.isSafeInteger(value.byteLength) || value.byteLength < 0
|| !value.chunks || typeof value.chunks !== 'object' || !(Symbol.asyncIterator in value.chunks)
|| typeof value.chunks[Symbol.asyncIterator] !== 'function')
return failure('invalid', 'A sized binary stream is required');
return success({ byteLength: value.byteLength, chunks: value.chunks as AsyncIterable<Uint8Array> });
}Related definitions: