pg-upload 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +32 -0
  2. package/package.json +2 -5
package/README.md ADDED
@@ -0,0 +1,32 @@
1
+ # Install
2
+
3
+ ```shell
4
+ npm install pg-upload
5
+ ```
6
+
7
+ # API
8
+
9
+ ```ts
10
+ upload(dp: pg.Pool, file: string, sql: string): Promise<void>
11
+ ```
12
+
13
+ # Use
14
+
15
+ Upload a local CSV-file to a database server for import
16
+ using the PostgreSQL copy command:
17
+
18
+ ```js
19
+ import pg from 'pg';
20
+ import { upload } from 'pg-upload';
21
+
22
+ const db = new pg.Pool({...});
23
+
24
+ await upload(
25
+ db,
26
+ 'some/path/to/data.csv',
27
+ `copy target_table (col1, col2, col3)
28
+ from stdin
29
+ with csv header encoding 'UTF-8'
30
+ `
31
+ );
32
+ ```
package/package.json CHANGED
@@ -1,12 +1,9 @@
1
1
  {
2
2
  "name": "pg-upload",
3
- "version": "0.0.3",
4
- "description": "Upload files to a PostgreSQL database for import",
3
+ "version": "0.0.4",
4
+ "description": "Uploads local files to a PostgreSQL database for import",
5
5
  "type": "module",
6
6
  "main": "index.js",
7
- "scripts": {
8
- "test": "echo \"Error: no test specified\" && exit 1"
9
- },
10
7
  "keywords": [
11
8
  "PostgreSQL",
12
9
  "upload",