Files @ e7e03c203c99
Branch filter:

Location: light9/web/lib/avro.ts

drewp@bigasterisk.com
resize cursor canvas for 400px tall spectros. fix canvas resolution code
import * as avrojs from "avro-js";
export namespace avro {
  export async function loadType(typeName: string): Promise<avrojs.types.Type> {
    const schemaSource = await (await fetch(`/avro/${typeName}.avsc`)).json();
    return await avrojs.parse(schemaSource);
  }
  
  export async function parseBlob(type: avrojs.types.Type, b: Blob): Promise<avrojs.types.Record> {
    const jsMsg = type.fromBuffer(Buffer.from(await b.arrayBuffer()));
    return jsMsg;
  }
}