diff options
Diffstat (limited to 'js/buffer.ts')
-rw-r--r-- | js/buffer.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/js/buffer.ts b/js/buffer.ts index b06259ed0..4e9cd6eb2 100644 --- a/js/buffer.ts +++ b/js/buffer.ts @@ -221,3 +221,11 @@ export class Buffer implements Reader, Writer { } } } + +/** Read `r` until EOF and return the content as `Uint8Array`. + */ +export async function readAll(r: Reader): Promise<Uint8Array> { + const buf = new Buffer(); + await buf.readFrom(r); + return buf.bytes(); +} |