mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 02:36:00 +00:00
export CSV from mysql test
This commit is contained in:
24
packages/api/src/shell/fakeObjectReader.js
Normal file
24
packages/api/src/shell/fakeObjectReader.js
Normal 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;
|
||||
Reference in New Issue
Block a user