Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pgtools

Package Overview
Dependencies
Maintainers
3
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pgtools

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

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14K
decreased by-3.12%
Maintainers
3
Weekly downloads
 
Created
Source

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: string | pg.ConnectionConfig, dbname: string): Promise<pg.QueryResult<any>>;
dropdb(config:  string | pg.ConnectionConfig, dbname: string): Promise<pg.QueryResult<any>>;

See ./src/index.d.ts for types.

See pg documentation for ConnectionConfig format.

More usage examples in ./src/test.js.

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.

Keywords

FAQs

Package last updated on 09 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc