npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ifraan_/weatherbit.js

v1.1.1

Published

Wrapper of WeatherBit API

Downloads

9

Readme

Instalation

Needs an API key, you can choose a free plan here

Needs Node v14+

Dependencies

axios

To install use:

npm i @ifraan_/weatherbit.js

Usage

You need to initialize the class first with the API key

const { API } = require('@ifraan_/weatherbit.js')
const api = new API(process.env.TOKEN);

Then you can query citys with the function search:

await api.search('New York')

Cache

This library cache results to reduce API usage, so if you keep doing the same query it should return the same result without calling the api again (if the time limit is not exceeded)

If you do not want to cache results, you must specify the option cache_time to be something like 0 ms.

Extra

You can pass options to the search function to tweak the settings as you like

| Option | Description | Default | | - | - | - | | lang | The language code | en | | units | M (Metric), S (Scientific) or I (Fahrenheit) | M | | debug | Print extra statements | false | | timeout | Timeout in ms | 10_000 (10 seconds) | | cache_time | Cache time in ms | 45 * 60_000 (45 minutes) |

You can also import types directly from the library and use it as options

const { API, UNITS, LANG } = require('@ifraan_/weatherbit.js');
const api = new API('TOKEN', {
	units: UNITS.Metric,
	lang: LANG.English,
})

Official Documentation

Disclaimer

This project is fully for educational purposes.