Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
download-file-sync
Advanced tools
Ever wanted to write a node script that just downloads a file synchronously? I'm sure you sometimes wish you worked on PHP and just used file_get_contents('url')
. Yeah it's going to be slow, yeah it won't scale, but that doesn't matter for your little script.
npm install download-file-sync --save
var downloadFileSync = require('download-file-sync');
var content = downloadFileSync('https://github.com/vjeux/download-file-sync');
// '<!DOCTYPE html><html lang="en"...'
That's it, now you can get back to writing awesome prototypes ;)
Here's the full implementation:
module.exports = function(url) {
return require('child_process')
.execFileSync('curl', ['--silent', '-L', url], {encoding: 'utf8'});
}
As you can imagine, this is not web scale, but it works!
FAQs
Does exactly what you expects
The npm package download-file-sync receives a total of 4,361 weekly downloads. As such, download-file-sync popularity was classified as popular.
We found that download-file-sync 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.