0.0.4 • Published 6 months ago

pg-upload v0.0.4

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

Install

npm install pg-upload

API

upload(dp: pg.Pool, file: string, sql: string): Promise<void>

Use

Upload a local CSV-file to a database server for import using the PostgreSQL copy command:

import pg from 'pg';
import { upload } from 'pg-upload';

const db = new pg.Pool({...});

await upload(
    db,
    'some/path/to/data.csv',
    `copy target_table (col1, col2, col3)
     from stdin
     with csv header encoding 'UTF-8'
    `
);
0.0.4

6 months ago

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago