async function readStreamToLocalFile(rs, file) {
    return new Promise((resolve, reject) => {
        const ws = fs__namespace.createWriteStream(file);
        rs.on("error", (err) => {
            reject(err);
        });
        ws.on("error", (err) => {
            reject(err);
        });
        ws.on("close", resolve);
        rs.pipe(ws);
    });
}
ONLY AVAILABLE IN NODE.JS RUNTIME.

Writes the content of a readstream to a local file. Returns a Promise which is completed after the file handle is closed.

@param rs - The read stream.
@param file - Destination file path.