1.2.4 • Published 12 months 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-builder
The 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
12 months ago
1.2.3
12 months ago
1.2.2
1 year ago
1.2.1
1 year ago
1.2.0
1 year ago
1.1.0
2 years ago
1.0.23
3 years ago
1.0.22
3 years ago
1.0.19
3 years ago
1.0.18
3 years ago
1.0.21
3 years ago
1.0.20
3 years ago
1.0.17
4 years ago
1.0.16
4 years ago
1.0.15
4 years ago
1.0.14
4 years ago
1.0.13
4 years ago
1.0.12
4 years ago
1.0.11
4 years ago
1.0.10
4 years ago
1.0.9
4 years ago
1.0.8
4 years ago
1.0.7
4 years ago