GithubHelp home page GithubHelp logo

meir017 / node-tgz-downloader Goto Github PK

View Code? Open in Web Editor NEW
26.0 4.0 23.0 757 KB

Downloads all of the node_modules tgz files based on a package-lock.json / pacakge.json file

License: MIT License

JavaScript 100.00%
npm-scripts tgz npm verdaccio

node-tgz-downloader's Introduction

Node.js CI NPM Version NPM Downloads

node-tgz-downloader

Downloads all of the tarballs based on one of the following:

  • local package-lock.json file
  • url to a package-lock.json
  • name of package
  • local package.json file
  • url to a package.json
  • search keyword

install

npm install node-tgz-downloader -g

usage

From Code:

const downloader = require('node-tgz-downloader');

downloader.downloadFromPackageLock('path/to/package-lock');

From Command Line:

package-lock.json

from local file:

download-tgz package-lock path/to/package-lock.json

from url:

download-tgz package-lock https://raw.githubusercontent.com/Meir017/node-tgz-downloader/master/package-lock.json

package name

download-tgz package @angular/cli --devDependencies --peerDependencies

package.json

from local file:

download-tgz package-json path/to/package.json

from url:

download-tgz package-json https://raw.githubusercontent.com/Meir017/node-tgz-downloader/master/package.json

search keyword

downloads the packages returned from an npm search query (https://registry.npmjs.org/-/v1/search?)

download-tgz search tgz

HttpsAgent Configuration

The tool supports the https_proxy environment variable. Do not forget to specify protocol and port.

export https_proxy='https://proxy_url:port'

node-tgz-downloader's People

Contributors

dependabot[bot] avatar deskoh avatar dmitrydodzin avatar elzapat avatar guylewin avatar liji84 avatar meir017 avatar murugaratham avatar noamkfir avatar sashokbg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

node-tgz-downloader's Issues

Download Rate Limiting

Possible to limit download concurrency (e.g. using p-limit) as I suspect I'm hitting the rate-limit for npm registry? I need to run several times (as previously downloaded tgz are skipped) before the download ran to completion.

image

Tried monkey-patching the original download

const promises = tarballs.map(({ url, directory }, i, arr) => {
const position = `${i + 1}/${arr.length}`;
logger(['downloading'.cyan, position], url);
return _downloadFileWithRetry(url, join(baseDirectory, directory), position, 10);
});
return Promise.all(promises);

with the following and it worked flawlessly.

  const asyncSequentialDownload = async () => {
    for (let i = 0; i < tarballs.length; i++) {
      const { url, directory } = tarballs[i];
      const position = `${i + 1}/${tarballs.length}`;
      logger(['downloading'.cyan, position], url);
      await _downloadFileWithRetry(url, join(baseDirectory, directory), position, 10);
    }
  }

  return asyncSequentialDownload();

Failed to download

Every package is located in a different folder

Hi, I am using the downloader to pack all packages and dependencies, and upload them to a private NPM repository. It would be much easier to do so if the downloader would put all the tgz files in the same folder, instead of a different folder for each file.
Is it possible to apply this behaviour as an optional argument to the downloader?

Tarball directory structure to mirror NPM registry

Is it possible to allow the tarballs download directory structure to mirror npm registry? Specifically the .tgz would be in a - directory (e.g. node-tgz-downloader/-/node-tgz-downloader-3.11.2-preview1.tgz)?

The intent is for mirroring npm packages into AirGap environment, something like package-bundle, however package-bundle does not allow you to download packages according to package-lock.json file.

Create http module

in order to simplify using a proxy we should move all http related function to a seperate module
#12

Not working with react-scripts

Hello,

I've tried your tool to download react-scripts package and the tool freeze at some point... Any idea ?

download-tgz package react-scripts

Regards,

proxy

Not working with proxy server, proxy wrote in .npmrc

download package.json failed

  • macos 10.13
  • node -v v16.14.2

when I run this command download-tgz package-json ./package.json --directory ./test --registry https://registry.npmjs.org/, it run successfully. but it seems the https turn to http in zsh,and there is no tarballs directory in the ./test directory in the end.
image

download-tgz package-lock is ok

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.