
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).
A module that diffs an input buffer with the previous one provided to it and outputs the diff as ANSI
A module that diffs an input buffer with the previous one provided to it and outputs the diff as ANSI. If you write out the diff to the terminal it will update the previous output with minimal changes
npm install ansi-diff
var diff = require('ansi-diff')({
// if you want to support word wrapping, provide the terminal width
width: process.stdout.columns
})
// render now
render()
// render every 1s
setInterval(render, 1000)
function render () {
// will update the terminal with minimal changes
process.stdout.write(diff.update('hello world...\n' + new Date()))
}
It also has terminal resize support
process.stdout.on('resize', function () {
diff.resize({width: process.stdout.columns})
render()
})
var diff = ansiDiff([options])
Create a new differ. Options include:
{
width: terminalWidth,
height: terminalHeight
}
If you provide the terminal width ansi-diff will be able to support word wrapping done by the terminal. That means that if you print out a line that is too long to fit in the terminal the diff will still work.
var changes = diff.update(buffer, opts)
Update the buffer and return the diff between this and the previous one. The diff is returned in ANSI as a buffer so you can write it out to the terminal.
opts.moveTo
- array of [column,row]
to move the cursor after diffing the
screen (in absolute coordinates)diff.resize([options])
Update the terminal width / height. If you are writing to stdout
you should update the width when process.stdout.on('resize')
is fired.
Options should look like this:
{
width: terminalWidth,
height: terminalHeight
}
diff.toString()
Returns the last diffed string.
diff.width
Property containing the last set terminal width.
diff.height
Property containing the last set terminal height.
FAQs
A module that diffs an input buffer with the previous one provided to it and outputs the diff as ANSI
The npm package ansi-diff receives a total of 73,484 weekly downloads. As such, ansi-diff popularity was classified as popular.
We found that ansi-diff demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
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.