Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
The 'dev-null' npm package provides a writable stream that acts as a black hole, discarding all data written to it. This can be useful for testing, benchmarking, or simply ignoring output that is not needed.
Writable Stream
Creates a writable stream that discards all data written to it. This is useful for scenarios where you need to provide a writable stream but do not care about the data being written.
const devnull = require('dev-null');
const stream = devnull();
stream.write('This data will be discarded');
stream.end();
Piping Data
Demonstrates how to pipe data from a readable stream to the dev-null writable stream, effectively discarding the data read from the input file.
const devnull = require('dev-null');
const fs = require('fs');
const readStream = fs.createReadStream('input.txt');
const writeStream = devnull();
readStream.pipe(writeStream);
The 'stream-buffers' package provides streams that store data in memory buffers. Unlike 'dev-null', which discards data, 'stream-buffers' allows you to access the data later. This can be useful for testing and debugging.
The 'through2' package provides a simple way to create transform streams. While 'dev-null' discards data, 'through2' allows you to manipulate data as it passes through the stream. This is useful for data processing tasks.
The 'noop-stream' package provides a writable stream that does nothing with the data written to it, similar to 'dev-null'. However, 'noop-stream' is a more lightweight alternative with fewer features.
/dev/null
for node streams
Use it whenever you need to interrupt stream flow for instance if you want to log the state of a stream instead of its output.
// without devnull
var numbers = require('../test/fixtures/number-readable')
numbers({ to: 2 })
.on('data', function (d) { console.log(d.toString()) });
// =>
// 0
// 1
// 2
// piping into devnull
var devnull = require('dev-null');
var numbers = require('../test/fixtures/number-readable');
numbers({ to: 2 })
.pipe(devnull())
.on('data', function (d) { console.log(d.toString()) });
// => (no output)
npm install dev-null
MIT
FAQs
/dev/null for node streams
The npm package dev-null receives a total of 268,509 weekly downloads. As such, dev-null popularity was classified as popular.
We found that dev-null 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.