
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
nats-memory-server
Advanced tools
nats-memory-server
is a Node.js package that provides an in-memory NATS server for testing and other purposes. It allows you to quickly set up and tear down a NATS server instance within your Node.js applications, making it easier to write tests and perform other operations that require a NATS server.
You can install nats-memory-server
using npm or yarn:
npm install nats-memory-server
or
yarn add nats-memory-server
Default configuration is:
For configuration, you can create one of the files:
{
"download": true,
"downloadDir": "node_modules/.cache/nats-memory-server",
"version": "v2.9.16",
"buildFromSource": false,
"binPath": "node_modules/.cache/nats-memory-server/nats-server"
}
/**
* @type {import('nats-memory-server').NatsMemoryServerConfig}
*/
const config = {
download: true,
downloadDir: 'node_modules/.cache/nats-memory-server',
version: 'v2.9.16',
buildFromSource: false,
binPath: 'node_modules/.cache/nats-memory-server/nats-server',
};
module.exports = config;
import type { NatsMemoryServerConfig } from 'nats-memory-server';
const config: NatsMemoryServerConfig = {
download: true,
downloadDir: 'node_modules/.cache/nats-memory-server',
version: 'v2.9.16',
buildFromSource: false,
binPath: 'node_modules/.cache/nats-memory-server/nats-server',
};
export default config;
package.json
You can declare the configurations in package.json
in the natsMemoryServer
field
{
"natsMemoryServer": {
"download": true,
"downloadDir": "node_modules/.cache/nats-memory-server",
"version": "v2.9.16",
"buildFromSource": false,
"binPath": "node_modules/.cache/nats-memory-server/nats-server"
},
}
You may use a method in the builder setArgs to pass the parameters
await NatsServerBuilder
.create()
.setArgs([`--jetstream`, `--store_dir`, os.tmpdir()])
.build()
.start();
Or you can pass it through the constructor
new NatsServer({
...DEFAULT_NATS_SERVER_OPTIONS,
args: [`--jetstream`, `--store_dir`, os.tmpdir()],
});
Contributions are welcome! If you find any issues or have suggestions for improvement, please feel free to open an issue or submit a pull request on the GitHub repository.
When contributing, please ensure to follow the code of conduct.
FAQs
Node.js package for an in-memory NATS server
The npm package nats-memory-server receives a total of 100 weekly downloads. As such, nats-memory-server popularity was classified as not popular.
We found that nats-memory-server demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.