import { Readable } from 'stream';
export async function toBuffer(stream) {
    return new Promise((resolve, reject) => {
        const buf = [];
        stream.on('data', (chunk) => buf.push(chunk));
        stream.on('end', () => resolve(Buffer.concat(buf)));
        stream.on('error', (err) => reject(`error converting stream - ${String(err)}`));
    });
}
export function toReadable(r) {
    if (typeof r === 'string')
        r = Buffer.from(r);
    return Readable.from(r);
}
//# sourceMappingURL=memory.fs.js.map