mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
20 lines
393 B
TypeScript
20 lines
393 B
TypeScript
import { Client } from "pg";
|
|
import { from, to } from "pg-copy-streams";
|
|
|
|
const client = new Client('fake-config-string');
|
|
|
|
const copyStream = client.query(from('copy data from stdin;'));
|
|
|
|
copyStream.write('', err => {
|
|
if (err) {
|
|
console.error(err);
|
|
return;
|
|
}
|
|
|
|
copyStream.end();
|
|
});
|
|
|
|
const readStream = client.query(to('copy data to stdout;'));
|
|
|
|
readStream.pipe(process.stdout);
|