npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

glad-stream-decoder

v1.0.0

Published

Transform stream to decode GLAD forest alerts

Readme

glad-stream-decoder

standard-readme compliant

Transform stream that decodes GLAD forest alerts

Global Forest Watch publishes weekly deforestation alerts as PNG map tiles. The data of the alert, the confidence level and intensity is encoded to the tile. This module decodes that information and creates an image tile with the alerts colored with the alpha transparency representing their intensity.

The transform stream expects raw image data, as you would get from reading the image data from the canvas. To decode a PNG to raw image data, and to re-encode the output to PNG, use png-stream

Table of Contents

Install

npm i glad-stream-decoder

Usage

var fs = require('fs')
var path = require('path')
var GLADStreamDecoder = require('glad-stream-decoder')
var PNGDecoder = require('png-stream/decoder')
var PNGEncoder = require('png-stream/encoder')

// encoded.png is an PNG encoded with date, confidence + intensity from
// http://wri-tiles.s3.amazonaws.com/glad_prod/tiles/{z}/{x}/{y}.png
var rs = fs.createReadStream('encoded.png'))
var ws = fs.createWriteStream('decoded.png'))

rs
  .pipe(new PNGDecoder())
  .pipe(new DecodeGLADStream({
    // Only show alerts since this date
    since: new Date(2017, 0, 1),
    // Color alerts green
    color: '#00FF00'
  }))
  .pipe(new PNGEncoder())
  .pipe(ws)

API

Table of Contents

GLADStreamDecoder

Transforms an encoded rgb image stream (a buffer of r,g,b values in order) from GLAD alerts into an rgba image stream with alerts as colored pixels opts.color and the intensity as the transparency of the pixel.

Parameters

  • opts object
    • opts.color (string | array) CSS color string or [red, green, blue] array for color of pixels
    • opts.since date Date object, filters alerts since this date

Maintainers

@gmaclennan

Contribute

PRs accepted.

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT © 2018 Digital Democracy