{"id":20507304,"url":"https://github.com/codingtuto/cweather-npm-","last_synced_at":"2025-04-13T21:52:34.486Z","repository":{"id":191686472,"uuid":"685184886","full_name":"codingtuto/cweather-npm-","owner":"codingtuto","description":"Package NPM de notre API Coding Weather","archived":false,"fork":false,"pushed_at":"2023-08-30T21:28:58.000Z","size":17,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-26T16:04:25.319Z","etag":null,"topics":["api","codingteam","nodejs","npm","weather"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/coding-weather","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/codingtuto.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,"governance":null}},"created_at":"2023-08-30T17:31:36.000Z","updated_at":"2024-02-18T21:10:34.000Z","dependencies_parsed_at":"2023-08-31T05:44:50.121Z","dependency_job_id":"4182af6b-75d3-4d99-8174-f717276ebe95","html_url":"https://github.com/codingtuto/cweather-npm-","commit_stats":null,"previous_names":["codingtuto/cweather-npm-"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingtuto%2Fcweather-npm-","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingtuto%2Fcweather-npm-/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingtuto%2Fcweather-npm-/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codingtuto%2Fcweather-npm-/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codingtuto","download_url":"https://codeload.github.com/codingtuto/cweather-npm-/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248788867,"owners_count":21161726,"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":["api","codingteam","nodejs","npm","weather"],"created_at":"2024-11-15T20:13:21.304Z","updated_at":"2025-04-13T21:52:34.457Z","avatar_url":"https://github.com/codingtuto.png","language":"JavaScript","readme":"# Coding Weather API (NPM)\n\n[![GitHub Repo](https://img.shields.io/github/repo-size/codingtuto/cweather-npm-)](https://github.com/codingtuto/cweather-npm-)\n[![GitHub Forks](https://img.shields.io/github/forks/codingtuto/cweather-npm-?style=social)](https://github.com/codingtuto/cweather-npm-/forks)\n[![GitHub Stars](https://img.shields.io/github/stars/codingtuto/cweather-npm-?style=social)](https://github.com/codingtuto/cweather-npm-/stargazers)\n[![GitHub Contributors](https://img.shields.io/github/contributors/codingtuto/cweather-npm-)](https://github.com/codingtuto/cweather-npm-/graphs/contributors)\n\n[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/codingtuto/cweather-npm-/Node.js%20CI)](https://github.com/codingtuto/cweather-npm-/actions/workflows/node.js.yml)\n[![Coverage Status](https://coveralls.io/repos/github/codingtuto/cweather-npm-/badge.svg?branch=main)](https://coveralls.io/github/codingtuto/cweather-npm-?branch=main)\n![Last Commit](https://img.shields.io/github/last-commit/codingtuto/cweather-npm-)\n\n[![npm](https://img.shields.io/npm/v/coding-weather)](https://www.npmjs.com/package/coding-weather)\n[![npm](https://img.shields.io/npm/dw/coding-weather)](https://www.npmjs.com/package/coding-weather)\n\n\u003ch1\u003eCoding Weather\u003c/h1\u003e\n\n\u003cp\u003e\u003cstrong\u003eNote:\u003c/strong\u003e Pour la documentation en francais, \u003ca href=\"#french-section\"\u003ecliquer ici\u003c/a\u003e.\u003c/p\u003e\n\n\n\u003cp\u003eThe \u003cstrong\u003eCoding Weather Package\u003c/strong\u003e is a Node.js package that provides a convenient way to fetch weather data using coordinates (latitude and longitude) from the CWeather API. It offers two modes of usage: the \"City Mode\" and the \"Coordinates Mode\". Additionally, you can access specific weather data fields such as temperature from the API response.\u003c/p\u003e\n\n\u003ch2\u003eInstallation\u003c/h2\u003e\n\n\u003cp\u003eYou can install the package using npm:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003enpm install coding-weather\u003c/code\u003e\u003c/pre\u003e\n\n\u003ch2\u003eUsage\u003c/h2\u003e\n\n\u003ch3\u003eCity Mode\u003c/h3\u003e\n\n\u003cp\u003eIn this mode, you can use the \u003ccode\u003eweather\u003c/code\u003e function to retrieve weather data based on a city name.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003econst { weather } = require('coding-weather');\n\nconst cityName = 'Mexico';\n\nweather(cityName, undefined, 'en')\n  .then(weatherData =\u003e {\n    console.log('Weather Data (EN - City Mode):', weatherData);\n  })\n  .catch(error =\u003e {\n    console.error('Error (EN - City Mode):', error.message);\n  });\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cpre\u003e\u003ccode\u003e// Response\n{\n  lat: 48.87,\n  lon: 2.33,\n  weather: {\n    id: 1003,\n    main: 'Partly cloudy',\n    icon: '//cdn.weatherapi.com/weather/64x64/day/116.png'\n  },\n  current: {\n    last_updated_epoch: 1693413900,\n    last_updated: '2023-08-30 18:45',\n    temp_c: 18,\n    temp_f: 64.4,\n    is_day: 1,\n    wind_mph: 9.4,\n    wind_kph: 15.1,\n    wind_degree: 320,\n    wind_dir: 'NW',\n    pressure_mb: 1011,\n    pressure_in: 29.85,\n    precip_mm: 0,\n    precip_in: 0,\n    humidity: 56,\n    cloud: 75,\n    feelslike_c: 18,\n    feelslike_f: 64.4,\n    vis_km: 10,\n    vis_miles: 6,\n    uv: 6,\n    gust_mph: 12.3,\n    gust_kph: 19.8\n  },\n  location: {\n    name: 'Paris',\n    region: 'Ile-de-France',\n    country: 'France',\n    tz_id: 'Europe/Paris',\n    localtime_epoch: 1693414114,\n    localtime: '2023-08-30 18:48'\n  }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003ch3\u003eCoordinates Mode\u003c/h3\u003e\n\n\u003cp\u003eYou can use the \u003ccode\u003eweather\u003c/code\u003e function to retrieve weather data based on coordinates (latitude and longitude). Specify the language as 'en' for English or 'fr' for French.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003econst { weather } = require('coding-weather');\n\nconst latitude = 48.8567;\nconst longitude = 2.3508;\n\nweather(latitude, longitude, 'en') // English language\n  .then(weatherData =\u003e {\n    console.log('Weather Data by Coordinates (EN):', weatherData);\n  })\n  .catch(error =\u003e {\n    console.error('Error:', error.message);\n  });\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cpre\u003e\u003ccode\u003e// Response\n{\n  lat: 36.1,\n  lon: 120.37,\n  weather: {\n    id: 1000,\n    main: 'Clear',\n    icon: '//cdn.weatherapi.com/weather/64x64/night/113.png'\n  },\n  current: {\n    last_updated_epoch: 1693413900,\n    last_updated: '2023-08-31 00:45',\n    temp_c: 22,\n    temp_f: 71.6,\n    is_day: 0,\n    wind_mph: 2.2,\n    wind_kph: 3.6,\n    wind_degree: 257,\n    wind_dir: 'WSW',\n    pressure_mb: 1012,\n    pressure_in: 29.88,\n    precip_mm: 0,\n    precip_in: 0,\n    humidity: 78,\n    cloud: 0,\n    feelslike_c: 24.6,\n    feelslike_f: 76.2,\n    vis_km: 10,\n    vis_miles: 6,\n    uv: 1,\n    gust_mph: 4,\n    gust_kph: 6.5\n  },\n  location: {\n    name: 'Qingdao',\n    region: 'Shandong',\n    country: 'China',\n    tz_id: 'Asia/Shanghai',\n    localtime_epoch: 1693414109,\n    localtime: '2023-08-31 00:48'\n  }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003ch3\u003eAccessing Specific Weather Data\u003c/h3\u003e\n\n\u003cp\u003eTo access specific weather data fields such as temperature, you can directly navigate through the response object returned by the API. Here's an example of how to access the temperature field:\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003e\n  weather(latitude, longitude, 'en')\n  .then(weatherData =\u003e {\n    const temperatureCelsius = weatherData.current.temp_c;\n    const temperatureFahrenheit = weatherData.current.temp_f;\n\n    console.log(`Temperature (C): ${temperatureCelsius}`);\n    console.log(`Temperature (F): ${temperatureFahrenheit}`);\n  })\n  .catch(error =\u003e {\n    console.error('Error:', error.message);\n  });\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003ch1 id=\"french-section\"\u003eDocumentation francaise\u003c/h1\u003e\n\n\u003cp\u003e\u003cstrong\u003eCoding Weather\u003c/strong\u003e est un package Node.js qui permet de récupérer des données météorologiques en utilisant des coordonnées (latitude et longitude) à partir de l'API CWeather. Il propose deux modes d'utilisation : le \"Mode Ville\" et le \"Mode Coordonnées\". De plus, il est possible d'accéder à des champs spécifiques des données météorologiques, comme la température, à partir de la réponse de l'API.\u003c/p\u003e\n\n\u003ch2\u003eInstallation\u003c/h2\u003e\n\n\u003cp\u003eVous pouvez installer le package à l'aide de npm :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003enpm install coding-weather\u003c/code\u003e\u003c/pre\u003e\n\n\u003ch2\u003eUtilisation\u003c/h2\u003e\n\n\u003ch3\u003eMode Ville\u003c/h3\u003e\n\n\u003cp\u003eDans ce mode, vous pouvez utiliser la fonction \u003ccode\u003eweather\u003c/code\u003e pour obtenir des données météorologiques en spécifiant le nom d'une ville. Vous pouvez choisir la langue 'fr' pour le français ou 'en' pour l'anglais.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003econst { weather } = require('coding-weather');\n\nconst cityName = 'paris';\n\nweather(cityName, undefined, 'fr')\n  .then(weatherData =\u003e {\n    console.log('Weather Data (FR - Mode Ville):', weatherData);\n  })\n  .catch(error =\u003e {\n    console.error('Erreur (FR - Mode Ville):', error.message);\n  });\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cpre\u003e\u003ccode\u003e// Exemple de réponse JSON en français\n{\n  lat: 48.87,\n  lon: 2.33,\n  meteo: {\n    id: 1003,\n    principal: 'Partiellement nuageux',\n    icone: '//cdn.weatherapi.com/weather/64x64/day/116.png'\n  },\n  actuel: {\n    dernier_maj_epoch: 1693413900,\n    dernier_maj: '2023-08-30 18:45',\n    temp_c: 18,\n    temp_f: 64.4,\n    est_jour: 1,\n    vitesse_vent_mph: 9.4,\n    vitesse_vent_kph: 15.1,\n    degre_vent: 320,\n    direction_vent: 'NW',\n    pression_mb: 1011,\n    pression_in: 29.85,\n    precip_mm: 0,\n    precip_in: 0,\n    humidite: 56,\n    nuage: 75,\n    sensation_c: 18,\n    sensation_f: 64.4,\n    visibilite_km: 10,\n    visibilite_miles: 6,\n    indice_uv: 6,\n    rafale_mph: 12.3,\n    rafale_kph: 19.8\n  },\n  lieu: {\n    nom: 'Paris',\n    region: 'Ile-de-France',\n    pays: 'France',\n    tz_id: 'Europe/Paris',\n    localtime_epoch: 1693414114,\n    localtime: '2023-08-30 18:48'\n  }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003ch3\u003eMode Coordonnées\u003c/h3\u003e\n\n\u003cp\u003eVous pouvez utiliser la fonction \u003ccode\u003eweather\u003c/code\u003e pour obtenir des données météorologiques en utilisant des coordonnées (latitude et longitude). Spécifiez la langue 'fr' pour le français ou 'en' pour l'anglais.\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003econst { weather } = require('coding-weather');\n\nconst latitude = 48.8567;\nconst longitude = 2.3508;\n\nweather(latitude, longitude, 'fr') // Langue française\n  .then(weatherData =\u003e {\n    console.log('Données Météo par Coordonnées (FR) :', weatherData);\n  })\n  .catch(error =\u003e {\n    console.error('Erreur :', error.message);\n  });\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003cpre\u003e\u003ccode\u003e// Exemple de réponse JSON en français\n{\n  lat: 36.1,\n  lon: 120.37,\n  meteo: {\n    id: 1000,\n    principal: 'Clair',\n    icone: '//cdn.weatherapi.com/weather/64x64/night/113.png'\n  },\n  actuel: {\n    dernier_maj_epoch: 1693413900,\n    dernier_maj: '2023-08-31 00:45',\n    temp_c: 22,\n    temp_f: 71.6,\n    est_jour: 0,\n    vitesse_vent_mph: 2.2,\n    vitesse_vent_kph: 3.6,\n    degre_vent: 257,\n    direction_vent: 'WSW',\n    pression_mb: 1012,\n    pression_in: 29.88,\n    precip_mm: 0,\n    precip_in: 0,\n    humidite: 78,\n    nuage: 0,\n    sensation_c: 24.6,\n    sensation_f: 76.2,\n    visibilite_km: 10,\n    visibilite_miles: 6,\n    indice_uv: 1,\n    rafale_mph: 4,\n    rafale_kph: 6.5\n  },\n  lieu: {\n    nom: 'Qingdao',\n    region: 'Shandong',\n    pays: 'Chine',\n    tz_id: 'Asia/Shanghai',\n    localtime_epoch: 1693414109,\n    localtime: '2023-08-31 00:48'\n  }\n}\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003ch3\u003eAccès à des Données Météorologiques Spécifiques\u003c/h3\u003e\n\n\u003cp\u003ePour accéder à des champs spécifiques des données météorologiques, comme la température, vous pouvez naviguer directement dans l'objet de réponse renvoyé par l'API. Voici un exemple d'accès au champ de température :\u003c/p\u003e\n\n\u003cpre\u003e\u003ccode\u003eweather(latitude, longitude, 'fr')\n  .then(weatherData =\u003e {\n    const temperatureCelsius = weatherData.actuel.temp_c;\n    const temperatureFahrenheit = weatherData.actuel.temp_f;\n\n    console.log(`Température (°C) : ${temperatureCelsius}`);\n    console.log(`Température (°F) : ${temperatureFahrenheit}`);\n  })\n  .catch(error =\u003e {\n    console.error('Erreur :', error.message);\n  });\n\u003c/code\u003e\u003c/pre\u003e\n\n\u003ch2\u003eLicence\u003c/h2\u003e\n\n\u003cp\u003eCe projet est sous licence \u003ca href=\"LICENSE\"\u003eMIT\u003c/a\u003e.\u003c/p\u003e\n\u003cp\u003eThis project is licensed under the \u003ca href=\"LICENSE\"\u003eMIT License\u003c/a\u003e.\u003c/p\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodingtuto%2Fcweather-npm-","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodingtuto%2Fcweather-npm-","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodingtuto%2Fcweather-npm-/lists"}