
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
redis-streams
Advanced tools
Extends the node redis client with readStream, writeStream, and writeThrough functions.
Extends the official node_redis client with additional functionality to support streaming data into and out of Redis avoiding buffering the entire contents in memory. The real work is powered by the redis-rstream and redis-wstream by @jeffbski.
npm install redis-streams
var redis = require('redis');
require('redis-streams')(redis);
This will extend the RedisClient
prototype with two additional functions:
readStream(key)
- get a Readable stream from redis.
writeStream(key, maxAge)
- get a Writable stream from redis.
writeThrough(key, maxAge)
- write to redis and pass the stream through.
var redis = require('redis');
require('redis-streams')(redis);
var redisClient = redis.createClient();
redisClient.readStream(key)
.pipe(process.stdout);
fs.createReadStream('file.txt')
.pipe(redisClient.writeStream(key, maxAge))
.on('finish', done);
fs.createReadStream('file.txt')
.pipe(redisClient.writeThrough(key, maxAge))
.pipe(process.stdout);
See the unit tests for additional usage examples.
You could also implement a Connect caching proxy middleware.
var redis = require('redis');
var request = require('request');
require('redis-streams')(redis);
var redisClient = redis.createClient();
app.get('/cache/:key', function(req, res, next) {
redis.exists(req.params.key, function(err, exists) {
if (err) return next(err);
if (exists)
return redis.readStream(req.params.key).pipe(res);
// Cache the remote http call for 60 seconds
request.get('http://somewhere.com/' + req.params.key)
.pipe(redis.writeThrough(req.params.key, 60))
.pipe(res);
});
});
The express-api-proxy module utilizes redis-streams
for this purpose, but in a more advanced way.
FAQs
Extends the node redis client with readStream, writeStream, and writeThrough functions.
The npm package redis-streams receives a total of 1,264 weekly downloads. As such, redis-streams popularity was classified as popular.
We found that redis-streams demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.