handlebars-helper-npm-downloads
v0.1.1
Published
Get the npm download counts for the specified repository.
Downloads
13
Maintainers
Readme
handlebars-helper-npm-downloads
Get the npm download counts for the specified repository.
Install
Install with npm:
$ npm i handlebars-helper-npm-downloads --save
Usage
var downloads = require('handlebars-helper-npm-downloads');
Use with [engine-handlebars][] in templates
app.asyncHelper('downloads', downloads);
Total downloads
{{downloads "micromatch"}}
Last 30 days of downloads
{{downloads "micromatch" 30}}
Last 30 days of downloads specified on the hash
{{downloads "micromatch" last=30}}
Last 30 days of downloads when last
is a property on an object called ctx
{{downloads "micromatch" ctx}}
API
downloads
Get the npm download counts for the specified repository.
Params
repo
{String}: Name of the repository to calculate download counts for.locals
{Number|Object}: Additional options to control how many days back to get. May be a number specifying last N days.locals.last
{Number}: Specify last N days to get downloads for. (Defaults to all downloads).options
{Object}: Handlebars options.options.hash.last
{Number}: Specify last N days on to the handlebars hash.{{downloads "micromatch" last=30}}
cb
{Function}: Callback function with signature(err, total)
.
Example
{{! when registered with `engine-handlebars` as `downloads` }}
{{downloads "micromatch"}}
{{! 17985264 }}
Related projects
- assemble: Assemble is a powerful, extendable and easy to use static site generator for node.js. Used… more | homepage
- download-stats: Get and calculate npm download stats for npm modules. | homepage
- engine: Template engine based on Lo-Dash template, but adds features like the ability to register helpers… more | homepage
- engine-base: Default engine for Template. | homepage
- generate: Fast, composable, highly extendable project generator with a user-friendly and expressive API. | homepage
- helper-npm-downloads: Get the npm download counts for the specified repository. | homepage
- npm-info: Base class for downloading data from the npm registry | homepage
- templates: System for creating and managing template collections, and rendering templates with any node.js template engine.… more | homepage
- verb: Documentation generator for GitHub projects. Verb is extremely powerful, easy to use, and is used… more | homepage
Running tests
Install dev dependencies:
$ npm i -d && npm test
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Author
Brian Woodward
License
Copyright © 2016 Brian Woodward Released under the MIT license.
This file was generated by verb on January 22, 2016.