Registry / database / redis-url-parser

redis-url-parser

JSON →
library0.0.3jsnpmunverified

Minimal npm package (v0.0.3) that parses Redis connection URLs into options objects. Last updated in 2015, no active maintenance. Parses host, port, password from URLs like redis://user:pass@host:port/db. Simpler alternative to redis-url or ioredis parsing, but lacks features like TLS, sentinel, or cluster support. Over 1 million weekly downloads due to inclusion in other packages, but unmaintained.

npm install redis-url-parser
INSTALL
IMPORT
SIG · REDIS-URL-PARSER
R
redis-url-parser
databasejavascriptv0.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

redisParser
const redisParser = require('redis-url-parser');
import redisParser from 'redis-url-parser';
CommonJS only; no ESM or TypeScript types. Use require().
parse
redisParser.parse(url);
redisParser(url);
The default export is an object with a parse method; not a function.
parse (result properties)
const { host, port, password, database } = redisParser.parse(url);
const { hostname, db } = redisParser.parse(url);
Returns 'host' (not 'hostname'), 'port' as integer, 'password', and 'database' (not 'db').

Parses a Redis URL into connection options using CommonJS require. Outputs host, port, password, and database.

const redisParser = require('redis-url-parser'); const url = 'redis://user:secret@redis.example.com:6380/1'; const options = redisParser.parse(url); console.log(options.host); // 'redis.example.com' console.log(options.port); // 6380 console.log(options.password); // 'secret' console.log(options.database); // '1'
Debug
Known issues
gotchaDoes not parse TLS/SSL URLs (rediss://) or support TLS options.
fix
Use ioredis or redis package with URL parsing if TLS is needed.
affects: >=0.0.0
gotchaThe 'database' property is returned as a string, not a number.
fix
Coerce to integer: parseInt(options.database, 10) or Number(options.database).
affects: >=0.0.0
gotchaNo support for sentinel or cluster URLs; only single-node redis:// URLs.
fix
Use ioredis or redis-sentinel for sentinel/cluster.
affects: >=0.0.0
deprecatedPackage is unmaintained since 2015. No bug fixes or security updates.
fix
Migrate to ioredis (built-in parsing) or the 'redis' package's URL parsing.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: redisParser is not a function
Using redisParser() directly instead of redisParser.parse().
fix
Use redisParser.parse(url);
Cannot find module 'redis-url-parser'
Package not installed or typo in require('redis-url-parser').
fix
Run 'npm install redis-url-parser' and ensure require path is correct.
TypeError: Cannot read properties of undefined (reading 'host')
Parsing an invalid URL or missing parse() call, returns undefined.
fix
Ensure URL string is valid and use redisParser.parse(url). Check result is not null.
Upgrade
Version history
0.0.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
redis-url-parser — npm install redis-url-parser · libregistry