{"id":16756825,"url":"https://github.com/charmander/libpq-connection-string","last_synced_at":"2026-04-12T16:11:20.881Z","repository":{"id":42681423,"uuid":"264745420","full_name":"charmander/libpq-connection-string","owner":"charmander","description":"libpq-compatible connection string parser","archived":false,"fork":false,"pushed_at":"2024-10-15T03:56:06.000Z","size":106,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-30T08:33:01.591Z","etag":null,"topics":["connection-string","libpq","node-postgres","pg","postgresql"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/charmander.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-17T19:54:36.000Z","updated_at":"2024-10-15T03:56:08.000Z","dependencies_parsed_at":"2025-01-22T19:52:42.613Z","dependency_job_id":null,"html_url":"https://github.com/charmander/libpq-connection-string","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/charmander/libpq-connection-string","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charmander%2Flibpq-connection-string","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charmander%2Flibpq-connection-string/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charmander%2Flibpq-connection-string/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charmander%2Flibpq-connection-string/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/charmander","download_url":"https://codeload.github.com/charmander/libpq-connection-string/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/charmander%2Flibpq-connection-string/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266120020,"owners_count":23879241,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["connection-string","libpq","node-postgres","pg","postgresql"],"created_at":"2024-10-13T03:42:10.585Z","updated_at":"2026-04-12T16:11:20.834Z","avatar_url":"https://github.com/charmander.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"A libpq-compatible[^1] connection string parser, like [`PQconninfoParse`][PQconninfoParse].\n\n[^1]: when the connection string is normally encoded as UTF-8 and the C locale is used for `isspace`\n\n```js\nimport parseConnectionString from 'libpq-connection-string';\n\nparseConnectionString('postgresql://host1:123,host2:456/somedb?target_session_attrs=any\u0026application_name=myapp')\n// { … dbname: 'somedb', host: 'host1,host2', port: '123,456' … }\n\nparseConnectionString('host=localhost port=5432 dbname=mydb connect_timeout=10')\n// { … connect_timeout: '10', dbname: 'mydb', host: 'localhost', port: '5432' … }\n```\n\nAll provided option values are parsed as strings, and all non-provided option values are `null`.\n\n\n## Service files\n\nlibpq-connection-string/add-service-defaults-sync is a function to read [service configuration][pgservice] synchronously.\n\n[LDAP][ldap] isn’t supported.\n\n\n## Environment defaults\n\nlibpq-connection-string/add-env-defaults is a function to add libpq defaults (excluding those that come from service files) to parsed options. It reads from:\n\n- environment variables\n- the current user’s username, if a user isn’t otherwise specified\n- a static set of fallback defaults\n\n\n## Examples\n\nGetting the defaults that `PQconnect` would use:\n\n```js\nimport parseConnectionString from 'libpq-connection-string';\nimport addServiceDefaultsSync from 'libpq-connection-string/add-service-defaults-sync';\nimport addEnvDefaults from 'libpq-connection-string/add-env-defaults';\n\nconst options = parseConnectionString('host=/run/postgres');\naddServiceDefaultsSync(options);\naddEnvDefaults(options);\n```\n\n[PQconninfoParse]: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PQCONNINFOPARSE\n[pgservice]: https://www.postgresql.org/docs/current/libpq-pgservice.html\n[ldap]: https://www.postgresql.org/docs/current/libpq-ldap.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharmander%2Flibpq-connection-string","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcharmander%2Flibpq-connection-string","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcharmander%2Flibpq-connection-string/lists"}