export CSV from mysql test

This commit is contained in:
Jan Prochazka
2020-06-04 11:18:46 +02:00
parent d05b319030
commit afbec02f3a
13 changed files with 185 additions and 2 deletions

View File

@@ -0,0 +1,24 @@
const stream = require('stream');
async function fakeObjectReader({ delay = 0 } = {}) {
const pass = new stream.PassThrough({
objectMode: true,
});
function doWrite() {
pass.write({ id: 1, country: 'Czechia' });
pass.write({ id: 2, country: 'Austria' });
pass.write({ id: 3, country: 'Germany' });
pass.write({ id: 4, country: 'Romania' });
pass.end();
}
if (delay) {
setTimeout(doWrite, delay);
} else {
doWrite();
}
return pass;
}
module.exports = fakeObjectReader;