By on .

At Dark Sky, we believe strongly in open source. Without some of the wonderful libraries out there, both the Dark Sky app and the Dark Sky API would have been utterly impossible to write. (Unless, maybe, you’re some kind of super-human cross-disciplinary programming savant.) Unfortunately, some of the tools we needed, we couldn’t find in the open-source toolbox. So we wrote them, and today we’re officially releasing some of them into the wild.


The Dark Sky API is written entirely (well, almost entirely) in Node.JS. We picked it from the beginning since it’s so darned fast and lightweight, we can power the entire API off of a few teensy virtual machines. All of the modules we’re releasing today were developed for the API, and so they’re all Node.JS modules. If you want to use them, they’re all handily available in NPM for your convenience.

  • cache-helpers: A set of abstracted, commonly-used caching patterns. The Dark Sky API is quite fast, and most of the reason for that is lots and lots of caching.

  • pngparse: a pure-JS means for parsing PNG images into a pixel array. We’ve mentioned before that Dark Sky stores gridded data as images: this module is how the API reads those images.

  • sphere-knn: an acceleration data structure for making k-nearest-neighbor queries on a sphere. Since most weather data comes from ground-based radar stations, looking up what stations are near a requested location is a common operation for us!

  • string-hash: A teensy little module for hashing strings to integers.

  • tz-lookup: Quickly lookup the timezone of a given latitude/longitude pair. We originally made use of the tzwhere module, but found it far too slow for production use. tz-lookup is a tad less precise, but an order of magnitude faster.

All of these modules are well-tested and have been in production use for a few months, so any kinks should be worked out by now. And, of course, we love to see forks and pull requests, so feel free to contribute to the modules if they don’t meet your needs!

We plan to release more of our modules in the future, but we’re working really hard on international support and some secret projects, so you’ll just have to wait. (It’ll be worth it, promise!)