@abh78989/fast-weather 中文文档教程

发布于 4年前 浏览 18 项目主页 更新于 3年前

Fast Weather

Fast-Weather 是一个易于使用的模块,没有 api 密钥!

Installation

npm i @abh78989/fast-weather

Quick Intro

  • searching
const weather = require("@abh78989/fast-weather");
weather.search("chicago").then(console.log);
/*
Search {
  results: [
    SearchRes {
      address: 'Chicago, Illinois, United States',
      district: [Object],
      city: 'Chicago',
      country: [Object],
      name: 'Chicago',
      timezone: 'America/Chicago',
      latitude: 41.876,
      postalCode: '60605',
      iataCode: 'MDW',
      icaoCode: 'KMDW'
    }
  ]
}
*/
//example is shortened
  • Getting Weather
const weather = require("@abh78989/fast-weather");
Weather.search("chicago").then(x=>x.results[0].weather().then(console.log))
/*
Weather {
  temperature: '12°',
  feelsLike: '11°',
  sunriseTime: '06:29',
  sunsetTime: '16:37',
  highest: '22°',
  lowest: '11°',
  windSpeed: '8 km/h',
  humidity: '67%',
  dewPoint: '6°',
  pressure: '1021.3 mb',
  UVIndex: '0 of 10',
  visibiliy: 'Unlimited',
  moonPhase: 'Waning Gibbous',
  AirQualityIndex: '43'
}
*/

Note

请使用语言指定华氏度或摄氏度 默认语言设置为 en-GB 摄氏度 您可以使用 en-US 华氏度

  • Example
Weather.search("chicago",{language : "en-US"})

#

source : Weather.com

Fast Weather

Fast-Weather is an easy to use module with no api key!

Installation

npm i @abh78989/fast-weather

Quick Intro

  • searching
const weather = require("@abh78989/fast-weather");
weather.search("chicago").then(console.log);
/*
Search {
  results: [
    SearchRes {
      address: 'Chicago, Illinois, United States',
      district: [Object],
      city: 'Chicago',
      country: [Object],
      name: 'Chicago',
      timezone: 'America/Chicago',
      latitude: 41.876,
      postalCode: '60605',
      iataCode: 'MDW',
      icaoCode: 'KMDW'
    }
  ]
}
*/
//example is shortened
  • Getting Weather
const weather = require("@abh78989/fast-weather");
Weather.search("chicago").then(x=>x.results[0].weather().then(console.log))
/*
Weather {
  temperature: '12°',
  feelsLike: '11°',
  sunriseTime: '06:29',
  sunsetTime: '16:37',
  highest: '22°',
  lowest: '11°',
  windSpeed: '8 km/h',
  humidity: '67%',
  dewPoint: '6°',
  pressure: '1021.3 mb',
  UVIndex: '0 of 10',
  visibiliy: 'Unlimited',
  moonPhase: 'Waning Gibbous',
  AirQualityIndex: '43'
}
*/

Note

Please use languages to specify fahrenheit or celcius by default language is set to en-GB for celsius you can use en-US for fahrenheit

  • Example
Weather.search("chicago",{language : "en-US"})

#

source : Weather.com
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文