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

gist-load

v1.0.0

Published

Load the content of a Gist file in the browser.

Downloads

3

Readme

gist-load

Load the content of a Gist file in the browser.

Features

  • Does not use the Github API, does not require an API token.
  • No dependency.
  • Written in conservative ES5.
  • Small bundle size.

Warning

Github may break this at any time so it isn't recommended to use this in any critical project. It is perfect to maintain an external list of presets for creative coding projects and the likes though.

Installing

With npm do:

npm install gist-load --production

Examples

Load json from a Gist with a single file

const gistLoad = require('gist-load');

gistLoad(
    {
        url: 'https://gist.github.com/kchapelier/8f0d755cc77e7e5a53d1cf9a38cbee6d',
        contentType: 'json'
    },
    function (error, data) {
        console.log('ERR:', error);
        console.log('DAT:', data);
    }
);

Load text from a Gist with multiple files

const gistLoad = require('gist-load');

gistLoad(
    {
        url: 'https://gist.github.com/kchapelier/8e41a80f88a4aec685a343151c38efcf',
        file: 'file2.txt',
    },
    function (error, data) {
        console.log('ERR:', error);
        console.log('DAT:', data);
    }
);

API

gistLoad(options, callback)

Load the content of a gist file.

Arguments

  • options :
    • url : String. Url of the Gist (mandatory)
    • file : String. Name of the file (mandatory for Gist with multiple files)
    • contentType : String. string or json, default to string
    • cache : Boolean. Whether to cache the result of the query, default to false
  • callback : A node-style / error-first callback.

History

1.0.0 (2019-06-02) :

  • First release

License

MIT