1.2.4 • Published 2 years ago
weather-builder v1.2.4
weather-builder
This is a module for building images from NWS data.
- It uses pureimage as an alternative to canvas. Its slower but no native dependencies.
Use stand alone. This creates image.jpg file in the current directory
$ npm install --save weather-builderThe following snippet shows how to use it:
import fs from 'fs';
import { WeatherImage } from 'weather-builder';
// module requires a logger that can be part of a bigger package
// This uses the minimal set of methods to work using just the console.
const logger = {};
logger.info = (...args) => {console.log(...args)};
logger.verbose = (...args) => {console.debug(...args)};
logger.warn = (...args) => {console.warn(...args)};
logger.error = (...args) => {console.error(...args)};
run() {
const weatherConfig: any = {
name: "Onset",
lat: "41.75",
lon: "-70.644",
title: "Forecast for Onset, MA",
days: 5
}
const weatherImage = new WeatherImage(logger);
const result = await weatherImage.getImageStream(weatherConfig);
if (result !== null && result.jpegImg !== null ) {
fs.writeFileSync('image.jpg', result.jpegImg.data);
} else {
logger.error("No jpegImg returned from weatherImage.getImageStream")
}
}
run();1.2.4
2 years ago
1.2.3
2 years ago
1.2.2
2 years ago
1.2.1
2 years ago
1.2.0
2 years ago
1.1.0
3 years ago
1.0.23
4 years ago
1.0.22
4 years ago
1.0.19
4 years ago
1.0.18
4 years ago
1.0.21
4 years ago
1.0.20
4 years ago
1.0.17
5 years ago
1.0.16
5 years ago
1.0.15
5 years ago
1.0.14
5 years ago
1.0.13
5 years ago
1.0.12
5 years ago
1.0.11
5 years ago
1.0.10
5 years ago
1.0.9
5 years ago
1.0.8
5 years ago
1.0.7
5 years ago