Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an API to get json data #35

Closed
styfle opened this issue Apr 16, 2018 · 3 comments
Closed

Add an API to get json data #35

styfle opened this issue Apr 16, 2018 · 3 comments
Assignees
Labels

Comments

@styfle
Copy link
Owner

styfle commented Apr 16, 2018

Some tools may want to display this install size but need their own formatting such as

So it would be good to provide an API, maybe use /api?p=packagename@version which is similar to /badge?p=packagename@version but returns json instead of an image.

@styfle
Copy link
Owner Author

styfle commented Apr 17, 2018

The API is available.

You can use the npm package name and version (cached result):

https://packagephobia.now.sh/[email protected]

Or simply the npm package name which will automatically use the latest version (never cached):

https://packagephobia.now.sh/api.json?p=next

@aleclarson
Copy link

Thank you for this! I'm going to fork https://github.com/wix/import-cost and use this instead. (That extension is known for gobbling CPU)

@styfle
Copy link
Owner Author

styfle commented Nov 16, 2018

@aleclarson Thanks for letting me know!

I'll add it to the README when you finish it 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants