- Defined in src/avro.ts:921
Properties
Methods
decode
- decode(data: ArrayBuffer | Uint8Array<ArrayBufferLike>): any
Decodes one Avro binary value, which must take up the whole input.
Parameters
- data: ArrayBuffer | Uint8Array<ArrayBufferLike>
Returns any
Throws
AvroError if the data is truncated, has bytes left over, or otherwise does not match the schema
- Defined in src/avro.ts:994
encode
- encode(value: any): Uint8Array
Encodes a value to Avro binary.
Parameters
- value: any
Returns Uint8Array
Throws
AvroError if the value does not match the schema; its
pathnames the offending field- Defined in src/avro.ts:974
StaticforSchema
Compiles a schema, or returns the type already compiled for it.
Parameters
- schema: AvroSchema
The schema as an object, as JSON text, or as the bare name of a primitive type such as
“long”
Returns AvroType
Throws
AvroError if the schema is invalid
- Defined in src/avro.ts:939
- schema: AvroSchema
An Avro type, compiled from its schema, that encodes values to Avro binary and decodes them back.
Values map to JavaScript as JSON-style data: records and maps to plain objects, arrays to arrays, bytes and fixed to Uint8Array, enums to their symbol strings, and null to null. A union takes the value as-is and is written as its first branch that accepts it.