parse-db-uri is a utility library designed to parse database connection URIs into a structured JavaScript object. It extends the output of the 'parse-url' package with database-specific fields such as `database`, `user`, `host`, `password`, and `dialect`. The library is currently stable at version 2.1.2, with recent updates including automatic decoding of passwords and usernames in the URI and added support for SQLite URIs. It provides a straightforward, function-based API for extracting components from common database URI formats, making it easier to configure database connections in applications. The release cadence is irregular but has seen active maintenance recently within the 2.x major version.
npm install parse-db-uriVerified import paths — ran on the pinned version, not inferred.
Demonstrates parsing MySQL, SQLite, and PostgreSQL database URIs into structured objects, including database-specific fields and environment variable usage for sensitive credentials.
Carefully review the package's behavior and the structure of the returned object if upgrading from a 1.x version. Consult the `parse-url` documentation for any upstream changes.
For ESM projects, always use `import parseDbUri from 'parse-db-uri';`. For CommonJS, use `const parseDbUri = require('parse-db-uri');`.No specific fix is required, but be mindful that the `user` and `password` fields in the parsed object will contain their decoded values. Adjust any downstream logic that might expect encoded characters.
Ensure the import statement is `import parseDbUri from 'parse-db-uri';` for ESM, or `const parseDbUri = require('parse-db-uri');` for CommonJS.Verify that `import parseDbUri from 'parse-db-uri';` or `const parseDbUri = require('parse-db-uri');` is present at the top of your module and that `parseDbUri` is spelled correctly wherever it's used.No dependency data recorded yet.