Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

download-file-sync

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

download-file-sync

Does exactly what you expects

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.3K
increased by2.62%
Maintainers
1
Weekly downloads
 
Created
Source

download-file-sync

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.

How to use?

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 ;)

How does it work

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

Package last updated on 21 Nov 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc