JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 15698
  • Score
    100M100P100Q137487F
  • License MIT

Pure Node.js implementation of PostgreSQL's createdb and dropdb tools

Package Exports

  • pgtools
  • pgtools/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pgtools) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

pgtools

Build
Status Coverage Status

Pure Node.js implementation of PostgreSQL's createdb and dropdb tools.

Only supports connection options and database name at the moment.

Install

npm install --save -g pgtools

CLI Example

createdbjs my_awesome_db --user=admin --password=admin

Library Example

const { createdb, dropdb } = require("pgtools");

// This can also be a connection string
// (in which case the database part is ignored and replaced with postgres)

const config = {
  user: "postgres",
  password: "some pass",
  port: 5432,
  host: "localhost",
};

await createdb(config, "test-db");
await dropdb(config, "test-db");

Usage

createdb(config, dbname): Promise<void>

dropdb(config, dbname): Promise<void>

  • object config

    An object with user, password, port, and host properties. This can also be a node-postgres compatible connection string.

  • string dbname

    The name of the database to create.

Bins

pgtools installs two useful binaries:

  • createdbjs: which emulates pgtools' createdb functionality.
  • dropdbjs: which emulates pgtools' dropdb functionality.

Node.js support

We support all LTS versions from 10 and up. We try to keep up with the latest Node.js version.