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

mt-downloader

v2.2.2

Published

resumable multi-threaded download over http/https

Downloads

353

Readme

mt-downloader

Build Status npm Commitizen friendly semantic-release js-standard-style

This is a nodejs based module that helps you in performing resumable, multi-threaded downloads via Http. The module is highly inspired by Speedbit's — Download Accelerator Plus.

Features

  1. Multi threaded downloads: In a conventional single threaded download you might experience poor performance due to network lags. So you don't completely utilize your bandwidth. With multiple threads there is always one thread which is getting data thus minimizing the wait period between data packets. This doesn't mean that you will be able to download faster than what your data plan. You will only be able to use the bandwidth in a more optimized fashion.

  2. Stop and start from the last downloaded byte:. You don't have to worry about internet getting disconnected or your computer shutting down while downloading. You can quite easily start from the last byte that was downloaded.

  3. Console application: If installed globally, mtd command would be available.

Installation

The conventional npm installation process needs to be followed.

npm install mt-downloader --save-dev

.mtd file

Once the download starts the library will create a file with a .mtd extension. This file contains some meta information related to the download and is a little bigger (around 512 bytes) than the original download size. The .mtd file can be used later to restart downloads from where the last byte that was downloaded. After the download is completed the downloader will truncate the file to remove that meta data.

New-Downloads

var createDownload = require('mt-downloader').createDownload
var url = 'https://upload.wikimedia.org/wikipedia/commons/4/47/Gadget_the_pug_expressive_eyes.jpg';
var path = '/Users/tusharmathur/Desktop/temp/Gadget_the_pug_expressive_eyes.jpg';
var downloader = createDownload({path, url});
downloader.start() // returns an observable

The start() method returns an observable. It can easily be converted into a promise by calling toPromise() method on it.

downloader.start().toPromise()

Re-Downloads

If you want to restart a download from where it left off. You just need to provide the path of the original file.

//File should have NOT have .mtd extension
var path = '/Users/tusharmathur/Desktop/temp/Gadget_the_pug_expressive_eyes.jpg'
var downloader = createDownload({path})
downloader.download().toPromise()

Event Stream

All the internal events are exposed as an observable via the stats property.

const downloader = createDownload({path, url})
downloader.stats.subscribe(x => console.log(x))
downloader.start()

/*
OUTPUT {event: <event>, message: <message>}
...
...
...
*/

Events include —

  • INIT: Fired as soon as the download is created.
  • CREATE: Fired when a .mtd file is created.
  • DATA: Fired every time some packet of data is SAVED.
  • TRUNCATE: Fired once the meta info is removed from the .mtd file.
  • RENAME:Fired once the file is renamed from .mtd to the original name.