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 🙏

© 2024 – Pkg Stats / Ryan Hefner

scram

v0.4.0

Published

wrap the Sacramento Open Data API (junar)

Downloads

12

Readme

scram: sacramento county retriever and munger

wrapping the Sacramento County Open Data api

NPM

Use:

  • $ npm install scram
  • visit http://data.saccounty.net/developers/ and obtain an API key
var scram = import(scram)
scram.apiKey = '21235avalidapikey142' //note the quotes
//scram.resouce = 'datastreams' // the default value, but change it...

// a stream of guids
scram.available()

//stream info to stdout by default, or pass custom callback as last arg
scram.info(guid)

// stream 3 results from data to stdout by default, or pass custom callback as last arg
scram.data(guid, 3)

The API provides several types of resources (datastreams, datasets, visualizations, and dashboards). By default, the only looks at datastreams. This can be changed by modifying the RESOURCES variable in .env.

Module

The module provides three functions:

  • available() : stream the guids available in datastreams to process.stdout
  • info(guid, infoProcessor): print info about a guid (or process with a custom callback function infoProcessor)
  • data(guid, limit=50, streamProcessor): stream data from guid to process.stdout (or process with a custom callback function streamProcessor)

Command line

The module also provides a wrapper for command-line interaction, scram-cli. It's set up to populate api key and default resource from a .env file.

Setup

  • npm install scram and npm link scram, which will put scram-cli in your path (and install scram globally)
  • copy or simlink bin/.env to the working directory where you will use the script
$ ln -s $(npm prefix -g)/lib/node_modules/scram/bin/.env .
  • open .env and edit the line below so after the = is the API key obtained from http://data.saccounty.net/developers/. Note no quotes here.
SAC_API_KEY=21235avalidapikey142

Use

Interact with the api from the command line!

Print help,

$ scram-cli -h

List all GUIDs in the current resource (defined in .env),

$ scram-cli

Query info (metadata) on a GUID

$ scram-cli info GUID

Stream data from a GUID

$ scram-cli data GUID

Contributing

  • Fork on github ( https://github.com/ashander/scram/fork )
  • Create a branch with a good name (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push the branch (git push origin -u my-new-feature)
  • Create a new Pull Request on github

Errata

Note: versions before 0.3.0 mistakenly contained an api key and have been unpublished.