npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

filedownloader

v1.2.7

Published

a small module for easy downloading using the power of curl combined with node js

Downloads

31

Readme

filedownloader

npm license github-issues

a small module for easy downloading using the power of curl combined with node js

nodei.co

travis-status stars forks

Note

this module requires curl to be present in your system path. if not please check those links

Linux Windows Mac Os

Quick start

    npm install filedownloader

Then:

    var Downloader = require("filedownloader");
    
    var Dl = new Downloader({
        url: "FILEURL"
    }).on("progress", function (progress){
        console.log(progress); 
    });

The Downloader function accepts an object that can take:

  • url url to Download from
  • saveas Filename to be saved as ex( audio.mp3)
  • saveto Folder to be saved in
  • deleteIfExists Delete file if it does exist (default: false)
  • resume Resume file if it's not completed, if false will delete the file and start it again (default: true)

The progress event will return :

    { progress: '1.3', dataWritten: 376072, filesize: '29828970', speed: 'byte/s'} //just an example of the ouput

Controlling The Download

you can pause the downloading by :

    Dl.pause();

and you can resume it by:

    Dl.resume();

Setting event handlers

'start': download started

The start event is emitted just after the download starts

    Dl.on("start", function(){
       console.log("Download started") 
    });

'progress': progress information

The progress Event is emitted with an object argument with the following keys:

  • dataWritten: size of downloaded data in bytes
  • filesize: size of the target file in bytes
  • progress: an estimation of the progress percentage
  • speed: an estimation of the download speed
    Dl.on("progress", function(progress){
       console.log('Downloaded: ' + progress.pregress + '%'); 
    });

'error': error occurred

The error event is emitted when an error occurs

    Dl.on("error", function(err){
       console.log('Some error occurred:' + err); 
    });

'end': Downloading finished

The end event is emitted when Downloading has finished.

    Dl.on("end", function(){
       console.log('Download finished'); 
    });

What's new

error event when status code is different than 200

Tests

npm test

Dependencies

  • content-disposition: Create and parse Content-Disposition header
  • del: Delete files and folders
  • file-exists: Check if filepath exists and is a file
  • mkdirp: Recursively mkdir, like mkdir -p
  • q: A library for promises (CommonJS/Promises/A,B,D)
  • request: Simplified HTTP request client.
  • underscore: JavaScript's functional programming helper library.
  • urlencode: encodeURIComponent with charset
  • valid-url: URI validation functions

Contributing

Contributions welcome; Please submit all pull requests the against master branch. If your pull request contains JavaScript patches or features, you should include relevant unit tests. Please check the Contributing Guidelines for more details. Thanks!

Author

Oussama Barkouki

License