
Product
A New Design for GitHub PR Comments
We redesigned our GitHub PR comments to deliver clear, actionable security insights without adding noise to your workflow.
redis-server
Advanced tools
Start and stop a local Redis server in Node.js like a boss.
npm install redis-server
The constructor exported by this module optionally accepts a single argument; a number or string that is a port or an object for configuration.
const RedisServer = require('redis-server');
// Simply pass the port that you want a Redis server to listen on.
const server = new RedisServer(6379);
server.open((err) => {
if (err === null) {
// You may now connect a client to the Redis
// server bound to port 6379.
}
});
Property | Type | Default | Description |
---|---|---|---|
bin | String | redis-server | A Redis server binary path. |
conf | String | A Redis server configuration file path. | |
port | Number | 6379 | A port to bind a Redis server to. |
slaveof | String | An address of a Redis server to sync with. |
A Redis server binary must be available. If you do not have one in $PATH, provide a path in configuration.
const server = new RedisServer({
port: 6379,
bin: '/opt/local/bin/redis-server'
});
You may use a Redis configuration file instead of configuration object
properties that are flags (i.e. port
and slaveof
). If conf
is
provided, no flags will be passed to the binary.
const server = new RedisServer({
conf: '/path/to/redis.conf'
});
For methods that accept callback
, callback
will receive an Error
as the first argument if a problem is detected; null
, if not.
Attempt to open a Redis server. Returns a Promise
.
open()
server.open().then(() => {
// You may now connect a client to the Redis server bound to `server.port`.
});
open()
server.open((err) => {
if (err === null) {
// You may now connect a client to the Redis server bound to `server.port`.
}
});
Close the associated Redis server. Returns a Promise
. NOTE: Disconnect
clients prior to calling this method to avoid receiving connection
errors from clients.
close()
server.close().then(() => {
// The associated Redis server is now closed.
});
close()
server.close((err) => {
// The associated Redis server is now closed.
});
Determine if the instance is starting a Redis server; true
while a
process is spawning, and/or about to be spawned, until the contained Redis
server either starts or errs.
Determine if the instance is running a Redis server; true
once a process
has spawned and the contained Redis server is ready to service requests.
Determine if the instance is closing a Redis server; true
while a
process is being, or about to be, killed until the contained Redis server either
closes or errs.
Emitted when a Redis server prints to stdout.
Emitted when attempting to start a Redis server.
Emitted when a Redis server becomes ready to service requests.
Emitted when attempting to stop a Redis server.
Emitted once a Redis server has stopped.
[1.2.2][] — 2018-06-12
#open()
returning a rejected promise due to a "Server can't set maximum
open files" errorFAQs
Start and stop a Redis server.
The npm package redis-server receives a total of 8,166 weekly downloads. As such, redis-server popularity was classified as popular.
We found that redis-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
We redesigned our GitHub PR comments to deliver clear, actionable security insights without adding noise to your workflow.
Product
Our redesigned Repositories page adds alert severity, filtering, and tabs for faster triage and clearer insights across all your projects.
Security News
Slopsquatting is a new supply chain threat where AI-assisted code generators recommend hallucinated packages that attackers register and weaponize.