dsn

1.0.2 • Public • Published

DSN Parser

Supports MySQL (mysql:) and Postgresql (pgsql:) schemes.

DSNs are a scheme, followed by semicolon (;), or, for command-line convenience, colon-separated (:) parameters in the form of key=value.

Valid parameters are host, port, dbname, user and password, and additionally username is accepted as a synonym for user.

All parameters are set as properties on the DSN object, except dbname is exposed as database.

Installation

npm install dsn

Usage

var parse = require('dsn').parse
 
var dsn = parse('mysql:host=db;dbname=myDBname')
 
/*
  protocol: 'mysql',
  host: 'db',
  database: 'myDBname'
*/

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.2
    919
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.2
    919
  • 1.0.1
    1
  • 1.0.0
    0
  • 0.0.2
    0
  • 0.0.1
    0

Package Sidebar

Install

npm i dsn

Weekly Downloads

557

Version

1.0.2

License

BSD

Unpacked Size

1.45 kB

Total Files

3

Last publish

Collaborators

  • aredridel
  • iarna