Glen Whitney
e0861ea157
I failed to find a satisfactory way to compile and import moo.js with fixed specifiers, so finally I just gave up and patched the distributed moo code to be an es6 module. Very ugly but it works. Resolves #1. Reviewed-on: #2 Co-authored-by: Glen Whitney <glen@studioinfinity.org> Co-committed-by: Glen Whitney <glen@studioinfinity.org>
11 lines
261 B
JavaScript
11 lines
261 B
JavaScript
export async function streamToString(stream) {
|
|
// lets have a ReadableStream as a stream variable
|
|
const chunks = [];
|
|
|
|
for await (const chunk of stream) {
|
|
chunks.push(Buffer.from(chunk));
|
|
}
|
|
|
|
return Buffer.concat(chunks).toString("utf-8");
|
|
}
|