export class Stream { public static readToEnd = async ( data ) => { let buffer = new Uint8Array ( ) ; const ws = new WritableStream < Uint8Array > ( { write : chunk => { buffer = new Uint8Array ( [ ... buffer , ... chunk ] ) ; } } ) ; await data . pipeTo ( ws ) ; return buffer ; } ; }