Skip to content

Latest commit

 

History

History
35 lines (23 loc) · 816 Bytes

File metadata and controls

35 lines (23 loc) · 816 Bytes

node-postgresql-keyword-value-to-uri

Convert PostgreSQL's keyword/value connection strings to URI connection strings.

Install

npm install \
  --ignore-scripts \
  --save \
  'github:c032/node-postgresql-keyword-value-to-uri#js'

Example

import { keywordValueToUri } from "postgresql-keyword-value-to-uri";

const connectionString = keywordValueToUri(
	`host=postgresql user=user_name password='correct horse battery staple' dbname=database_name sslmode=disable`
);

// `connectionString` is "postgresql://user_name:correct%20horse%20battery%20staple@postgresql/database_name?sslmode=disable".

F.A.Q.

Why not send PR to pg-connection-string?

See brianc/node-postgres#2125.

License

MPL 2.0.