Git Product home page Git Product logo

npmtotal's Introduction

npmtotal

Find your npm download statistics by author or packages, can be used as a CLI or Module

Installation

npm i npmtotal -g

or

npm i npmtotal when consuming as a module

Usage

CLI

For npm author

npx npmtotal --author authorName

and for npm packages

npx npmtotal --packages package1 package2 ...

Module

const npmtotal = require("npmtotal");

// author
(async () => {
  console.log(await npmtotal("maddhruv"));
})();

// packages
(async () => {
  console.log(await npmtotal(["npmtotal", "post-merge-install"]));
})();

The returned object is of this structure.

{
  stats: [
    [String(packageName), Number(downloads)]
  ],
  sum: Number(totalDownloads)
}

Options

You can pass several options as the second param.

Option Description Default value
exclude an array of packages to exclude []
startDate start date for counting downloads today - 1 year
endDate end date for counting downloads today

You can also pass startDate and endDate as options to the CLI

npx npmtotal --author maddhruv --startDate '2020-01-01' --endDate '2020-01-03'

Related

  • npm-statistics - NPM Download Stats updated daily with badge and readme update

npmtotal's People

Contributors

dependabot[bot] avatar maddhruv avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar

npmtotal's Issues

CLI: output is not sorted

npx npmtotal --author=ljharb does not sort the output by package name, or by downloads descending or ascending. I'd expect it to be sorted by one or the other, with a command line option for the alternatives.

CLI: default date span?

I'd expect it to default to the last 24 hours; but it'd also be great to have an easy CLI option to select the last week, month, 3 months, 6 months, year, etc under, say, --duration=

Also, perhaps --start-date= and --end-date= which are mutually exclusive with --duration=.

Exclusion patterns + exclude private packages

I'd like to exclude private packages (scoped packages that are not public), ideally by default.

I'd also like to provide patterns like "browserify", for example, to exclude all the browserify packages that I have publish rights to but don't actually maintain.

CLI: output messes with the prompt

In the same way that using printf causes the next prompt to not necessarily be after the output vs echo, whatever you're using to output causes my next prompt to appear in the middle of it, instead of after it.

Perhaps this is because you're not stopping the progress bar until after you've console.logged the results?

CLI: no way to disambiguate package vs author

browserify is both a package and an org, and npx npmtotal browserify reports nothing - which seems strange.

npx npmtotal substack (which is both a package and a user) presumably presents a similar problem.

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.