{"id":24835753,"url":"https://github.com/tobilg/npm-stats-cli","last_synced_at":"2025-10-09T12:32:39.900Z","repository":{"id":65465215,"uuid":"115633304","full_name":"tobilg/npm-stats-cli","owner":"tobilg","description":"A command line interface for npm statistics and insights","archived":false,"fork":false,"pushed_at":"2019-07-24T07:12:30.000Z","size":414,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-13T14:59:09.569Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tobilg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-28T14:57:36.000Z","updated_at":"2020-06-08T15:19:00.000Z","dependencies_parsed_at":"2023-01-24T17:45:23.538Z","dependency_job_id":null,"html_url":"https://github.com/tobilg/npm-stats-cli","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobilg%2Fnpm-stats-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobilg%2Fnpm-stats-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobilg%2Fnpm-stats-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobilg%2Fnpm-stats-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tobilg","download_url":"https://codeload.github.com/tobilg/npm-stats-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236464833,"owners_count":19152979,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-31T04:51:35.914Z","updated_at":"2025-10-09T12:32:34.866Z","avatar_url":"https://github.com/tobilg.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# npm-stats-cli\nA command line interface for npm registry statistics and insights, either per user or per package. \n\nIt supports flexible outputs, such as JSON, ASCII chart, CSV and TSV. Also, it can aggregate the data on daily, monthly and yearly levels. \n\n## Installation\n\nYou can install `npm-stats-cli` as a global package in the usual way:\n\n```bash\n$ npm install npm-stats-cli -g\n```\n\n## Usage\n\n### Chart example \n![Chart stats](docs/images/npm-stats-0.png)\n\n### TSV example\n![TSV stats](docs/images/npm-stats-1.png)\n\n### Command overview\n\nBy typing \n\n```bash\n$ npm-stats --help\n```\n\nyou can display the complete list of possible flags:\n\n```text\nnpm-stats usage:\n--------------------------\n \nArguments:\n--package \u003cpackageName\u003e     The package name to gather statistics from.\n--user \u003cuserName\u003e           The name of the NPM registry user to gather statistics from.\n                            This will generate statistics for all public modules of the user.\n--by-package                This can be used to gather user-level statistics by package name.\n--granularity \u003cgranularity\u003e The level of aggregation ('daily', 'monthly', 'yearly'). Default is 'monthly'.\n--output \u003ctype\u003e             How the statistics should be generated ('json', 'chart', 'csv', 'tsv'). Default is 'json'.\n--start \u003cstartDate\u003e         The start date (in 'YYYY-MM-DD' format).\n--end \u003cendDate\u003e             The end date (in 'YYYY-MM-DD' format).\n--registry-url              The URL of the registry endpoint, including the protocol. Default is 'https://registry.npmjs.org'.\n--api-url                   The URL of the registry API endpoint, including the protocol. Default is 'https://api.npmjs.org'.\n \nHints:\nEither --package or --user flags are mandatory. If neither --start or --end is specified,\nthe data from yesterday will be used.\n```\n\n## Getting user-level statistics\n\n### Basic usage\n\n```bash\n$ npm-stats --user tobilg\n```\n\nThis will output the download statistics of all of the user `tobilg`'s packages from yesterday, aggregated to monthly level, and output as JSON.\n\n```bash\n{\"years\":{\"2017\":{\"downloads\":25,\"months\":{\"12\":{\"downloads\":25}}}}}\n```\n\n### Specifying granularity and output type\n\n```bash\n$ npm-stats --user tobilg --granularity daily --output tsv\n```\n\nThis will output the download statistics of all of the user `tobilg`'s packages from yesterday, aggregated to daily level, and output as TSV.\n\n```bash\nyear    month   day     downloads\n2017    12      29      25\n```\n\n### Getting by-package level statistics\n\n```bash\n$ npm-stats --user tobilg --granularity daily --output tsv --by-package\n```\n\nThis will output the download statistics of all of the user `tobilg`'s packages from yesterday (on package level), aggregated to daily level, and output as TSV.\n\n```bash\nyear    month   day     package downloads\n2017    12      29      buffered-queue  1\n2017    12      29      ceph-admin-ops-client   0\n2017    12      29      facebook-events-by-location     0\n2017    12      29      facebook-events-by-location-core        11\n2017    12      29      fs2obj  8\n2017    12      29      kafka-node-slim 0\n2017    12      29      marathon-event-bus-client       0\n2017    12      29      marathon-event-bus-mock 0\n2017    12      29      marathon-validate       0\n2017    12      29      mesos-framework 0\n2017    12      29      mesos-operator-api-client       0\n2017    12      29      mesosctl        0\n2017    12      29      mesosdns-cli    0\n2017    12      29      mesosdns-client 0\n2017    12      29      mesosdns-http-agent     0\n2017    12      29      no-kafka-slim   5\n```\n\n### Specifying start and end dates\n\nThe given [limits](https://github.com/npm/registry/blob/master/docs/download-counts.md#limits) of the npm registry API apply:\n\n* 365 days of data\n* Earliest date for which data will be returned is `2015-01-10`\n\n```bash\n$ npm-stats --user tobilg --start 2017-12-01 --end 2017-12-05 --granularity daily --output tsv\n```\n\nThis will output the download statistics of all of the user `tobilg`'s packages from `2017-12-01` to `2017-12-05`, aggregated to daily level, and output as TSV.\n\n```bash\nyear    month   day     downloads\n2017    12      1       72\n2017    12      2       39\n2017    12      3       14\n2017    12      4       139\n2017    12      5       79\n```\n\n### Getting a ASCII chart from the statistics\n\n```bash\n$ npm-stats --user tobilg --granularity daily --output chart --start 2017-10-01 --end 2017-11-30\n```\n\nThis will output the download statistics of all of the user `tobilg`'s packages from `2017-10-01` to `2017-11-30`, aggregated to daily level, and output as ASCII chart.\n\n```text\n     296.00 ┤           ╭╮                                                  \n     277.00 ┤           ││       ╭╮                                         \n     258.00 ┤       ╭╮  ││       ││                                         \n     239.00 ┤       ││  ││       ││                                         \n     220.00 ┤       ││ ╭╯│       ││                                         \n     201.00 ┤       ││ │ │       ││                                         \n     182.00 ┤       ││ │ │       │╰─╮                                       \n     163.00 ┤ ╭╮    ││ │ │       │  │        ╭╮                             \n     144.00 ┤ ││╭╮  ││╭╯ │       │  │        ││                             \n     125.00 ┤ │││╰╮ │││  │╭╮╭╮   │  │    ╭╮ ╭╯│                   ╭╮   ╭╮   \n     106.00 ┼╮│╰╯ │ │││  │││││ ╭╮│  ╰╮╭╮ ││╭╯ ╰╮                ╭╮││  ╭╯╰╮  \n      87.00 ┤││   ╰╮│╰╯  ││││╰─╯╰╯   ╰╯│ │╰╯   │ ╭╮      ╭─╮   ╭╯│││ ╭╯  │  \n      68.00 ┤╰╯    ││    ││╰╯          │ │     │ ││╭╮    │ ╰╮ ╭╯ ╰╯│ │   ╰╮ \n      49.00 ┤      ││    ││            │ │     │ │╰╯│  ╭─╯  │ │    │ │    │ \n      30.00 ┤      ╰╯    ││            ╰─╯     ╰─╯  │  │    │ │    │ │    ╰ \n      11.00 ┤            ╰╯                         ╰──╯    ╰─╯    ╰─╯      \n```\n\n## Getting package-level statistics\n\nThe `--by-package` flag is enabled automatically by default, so it doesn't need to be specified.\n\n### Basic usage\n\n```bash\n$ npm-stats --package axios\n```\n\nThis will output the download statistics of the `axios` package from yesterday, aggregated to monthly level, and output as JSON.\n\n```bash\n{\"years\":{\"2017\":{\"downloads\":75897,\"months\":{\"12\":{\"downloads\":75897,\"packages\":{\"axios\":{\"downloads\":75897}}}}}}}\n```\n\n### Other options\n\nThe other options and possibilities are the same as for the user-level statistics (see above).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobilg%2Fnpm-stats-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftobilg%2Fnpm-stats-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobilg%2Fnpm-stats-cli/lists"}