function downloadBlob(blob, name) {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = url;
a.download = name;
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
}
in NodeJS you could also use blob.text() to get a promise to its contents so smth like could work:
async writeBlob(b, file) {
const txt = await b.text();
await fs.writeFile(file, txt)
}