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

mcdownloader

v0.1.1

Published

Multi-connection, resumable, file download library for Nodejs

Downloads

8

Readme

NOTE: This is an opinionated rework of the original mt-files-downloader code.

This codebase enhances upon the original work with the following:

Features

  1. HTTP & HTTPS downloads work: Working download for both protocols. Refer to code examples below.

  2. Properly Downloads Redirecting URLs: Sometimes URLs will redirect to another URL, for N times. This library will follow redirects until it finds the source.

  3. Windows Support: Add official support for Windows 10 x64 and Windows Server 2012 R2 (32 + 64 bit) operating systems.

  4. Multi connection downloads: In a conventional single connection download you might experience poor performance due to network lags etc. With multi connections will speed up it.

  5. 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.

  6. Cancel download: You can cancel download when any time.

.mcd file

Once the download starts the library will create a file with a .mcd extension. This file contains some meta information related to the download and is a little bigger (around 10kb) than the original download size. The .mcd 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.

Install

npm install mcdownloader --save

or

yarn add mcdownloader

New-Downloads

When you want to start a new download you just need to provide a download url and a download path and call the start() method.

const MCD = require('mcdownloader');

const options = {
  url: 'https://nodejs.org/dist/v12.16.1/node-v12.16.1-x64.msi',
  output: './node-v12.16.1-x64.msi',
  count: 2,
  range: '0-100',
  onProgress: console.log,
};
const nd = new MCD(options);
nd.exec().then(() => {
  console.log('done successfully');
}).catch(e => {
  console.log(e);
});

Re-Downloads

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

const MCD = require('mcdownloader');

const options = {
  output: './node-v12.16.1-x64.msi.mcd',
};
const nd = new MCD(options);
nd.exec().then(() => {
  console.log('done successfully');
}).catch(e => {
  console.log(e);
});

Download Options

A set of custom options can be sent to control the way a download is performed.

const options = {
	url: null, // file url to download
	output: null, // downloaded file name
	count: 2, // connections count
	range: '0-100', // file range to download, from 0% to 100% by default
	onProgress: console.log, // progress callback
	headers: {}, // http request headers
	downloadType: 'download', // new download
};