Socket
Socket
Sign inDemoInstall

auto-downloader

Package Overview
Dependencies
64
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    auto-downloader

An automatic background downloader using an file as input


Version published
Weekly downloads
6
decreased by-25%
Maintainers
1
Install size
4.10 MB
Created
Weekly downloads
 

Readme

Source

Auto Downloader

Installation

npm

npm install auto-downloader

Yarn

yarn add auto-downloader

Configuration

You can customize the default behavior of the Auto Downloader passing options.

Here are the defaults:

{   
    "path": {
        "errors": "data/var",
        "progress": "data/var",
        "canceled": "data/var",
        "finished": "data/var",
        "queue": "."
    },
    "output": "downloads",
    "parallelDonwloads": 3,
    "postDownload": null
}

path: The directories used in the application. path.errors: The directory that the errors of the downloads will be saved. The errors.json file have this format:

{
	"url": "...",
	"filename": "...",
	"message": "..."
}

path.progress: The directory that the progress of the downloads will be saved. The filename is progress.json. The format is generated by request-progress:

{
    "download-link": {
        "time": {
            "elapsed": 0, // The total elapsed seconds since the start (3 decimals)
            "remaining": 0 // The remaining seconds to finish (3 decimals)
        },
        "speed": 0, // The download speed in bytes/sec
        "percent": 0, // Overall percent (between 0 to 1)
        "size": {
            "total": 0, // The total payload size in bytes
            "transferred": 0 // The transferred payload size in bytes
        }
    }
}

path.canceled: The directory that the information of canceled downloads will be saved. The canceled.json have this format:

[
    {
        "url": "...",
        "filename": "..."
    }
]

path.finished: The directory that the information of completed downloads will be saved. The finished.json have this format:

[
    {
        "url": "...",
        "filename": "..."
    }
]

path.queue: The location of the file with the links to downloads. The format is here.
output: The directory where the files will be downloaded.
parallelDownloads: The number of downloads performed at the same time.

postDownload: An shell command with will be executed when the downloads are finished. The command will have access to three constants of the download:

  • %filename%: The name of the file downloaded with extension.
  • %filedir%: The name of the directory that the file has been downloaded.
  • %filepath%: The absolute path to the file downloaded.

Usage

const downloader = require('auto-downloader');

downloader(options);
Download

You can paste on this file every link that you want to download. By default, the filename of the downloads will be download-<link> without extension. To save the file with an specific name and extension, you could the > operator:

link > filename.extension

You can use absolute paths too:

link > /home/user/filename.extension
Cancel Downloads

In the progress.json file, in addition to the downloads information, you will have the hash key in each download of the array. You can copy this hash and use the ! operator to cancel that download:

!hash

FAQs

Last updated on 28 Jun 2020

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc