Open lowlighter opened 5 months ago
Currently we support ReaderSync but it's be nice to be able to pass a async Reader
ReaderSync
Reader
/** Asynchronous reader. */ type Reader = { read(buffer: Uint8Array): Promise<Nullable<number>> } /** Mocked reader */ class MockReader implements Reader { constructor(string: string) { this.#data = new TextEncoder().encode(string) } readonly #data #cursor = 0 async read(buffer: Uint8Array) { const bytes = this.#data.slice(this.#cursor, this.#cursor + buffer.length) buffer.set(bytes) this.#cursor = Math.min(this.#cursor + bytes.length, this.#data.length) return bytes.length || null } }
This however may require a bit of work since we need to patch xml/wasm_xml_parser/src/lib.rs to support asynchronous reading, possibly using tokio ?
Currently we support
ReaderSync
but it's be nice to be able to pass a asyncReader
This however may require a bit of work since we need to patch xml/wasm_xml_parser/src/lib.rs to support asynchronous reading, possibly using tokio ?