1.1.0 • Published 9 months ago
weather-builder v1.1.0
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.1.0
9 months ago
1.0.23
2 years ago
1.0.22
2 years ago
1.0.19
2 years ago
1.0.18
2 years ago
1.0.21
2 years ago
1.0.20
2 years ago
1.0.17
3 years ago
1.0.16
3 years ago
1.0.15
3 years ago
1.0.14
3 years ago
1.0.13
3 years ago
1.0.12
3 years ago
1.0.11
3 years ago
1.0.10
3 years ago
1.0.9
3 years ago
1.0.8
3 years ago
1.0.7
3 years ago