{"library":"parse-redis-url-simple","title":"Redis URL Parser (Simple)","description":"parse-redis-url-simple is a focused JavaScript utility designed for parsing Redis connection URLs, including complex scenarios like Redis Sentinel configurations. It provides a simple, direct API for converting various URL formats into structured objects containing host, port, database, and password. Unlike several unmaintained or production-unsuitable prior art libraries mentioned in its README, this package aims to offer a robust and reliable solution for production environments. Currently at version 1.0.2, it appears to follow a stable release cadence typical of utility libraries, with updates primarily for bug fixes or minor enhancements. A key differentiator is its explicit support for ioredis-compatible Sentinel URLs, addressing a common need in distributed Redis setups.","language":"javascript","status":"active","last_verified":"Tue Apr 21","install":{"commands":["npm install parse-redis-url-simple"],"cli":null},"imports":["import parseRedisUrl from 'parse-redis-url-simple';","const parseRedisUrl = require('parse-redis-url-simple');","import parseRedisUrl from 'parse-redis-url-simple';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import parseRedisUrl from 'parse-redis-url-simple';\n\n// Parse a basic Redis URL with a specific database\nconst basicUrl = 'redis://localhost:6379/1';\nconsole.log('Basic URL:', parseRedisUrl(basicUrl));\n// => [{host: 'localhost', port: 6379, database: '1', password: undefined}]\n\n// Parse multiple Redis instances from a comma-separated string\nconst multipleUrls = 'redis://barhost.com:39143/,redis://foohost.com:39143/';\nconsole.log('Multiple URLs:', parseRedisUrl(multipleUrls));\n// => [{host: 'barhost.com', port: 39143, database: '0', password: undefined}, {host: 'foohost.com', port: 39143, database: '0', password: undefined}]\n\n// Parse a Redis URL that includes a password (username is ignored)\nconst passwordUrl = 'redis://user:n9y25ah7@foohost.com:39143/';\nconsole.log('Password URL:', parseRedisUrl(passwordUrl));\n// => [{host: 'foohost.com', port: 39143, database: '0', password: 'n9y25ah7'}]\n\n// Parse Redis Sentinel URLs by passing `true` as the second argument\nconst sentinelHosts = 'barhost.com:39143,foohost.com:39143,foobarhost.com:39143';\nconsole.log('Sentinel Hosts:', parseRedisUrl(sentinelHosts, true));\n// => [{host: 'barhost.com', port: 39143},{host: 'foohost.com', port: 39143},{host: 'foobarhost.com', port: 39143}]","lang":"typescript","description":"This quickstart demonstrates how to parse various Redis URL formats, including single instances, multiple comma-separated instances, URLs with passwords, and Redis Sentinel configurations using the `parseRedisUrl` function.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}