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

imgur-v2

v0.2.1

Published

Upload images to imgur.com v2

Readme

imgur-v2

Since the original publisher seems te be inactive I have created this fork without the CLI support but with new features.

Original package node-imgur

Module Usage

Installation

npm install imgur-v2

Usage

Requiring the module:

var imgur = require('imgur-v2');

Dealing with client IDs:

// Setting
imgur.setClientId('aCs53GSs4tga0ikp');

// Getting
imgur.getClientId();

// Saving to disk. Returns a promise.
// NOTE: path is optional. Defaults to ~/.imgur
imgur.saveClientId(path)
    .then(function () {
        console.log('Saved.');
    })
    .catch(function (err) {
        console.log(err.message);
    });


// Loading from disk
// NOTE: path is optional. Defaults to ~/.imgur
imgur.loadClientId(path)
    .then(imgur.setClientId);

Dealing with API URL:

In order to change the API Url say Mashape URL, use setAPIUrl(MashapeURL)

//Setting
imgur.setAPIUrl('https://api.imgur.com/3/');

//If setAPIUrl() is not called, API URL is read from process.env.IMGUR_API_URL

//Getting
imgur.getAPIUrl();

Dealing with Mashape Key

Requests to the Mashape URL expects a X-Mashape-Key: MashapeKey header. Set Mashape Key by using setMashapeKey(MashapeKey) method. Note: Defaults to process.env.IMGUR_MASHAPE_KEY

//Setting
imgur.setMashapeKey(https://imgur-apiv3.p.mashape.com/);

//Getting
imgur.getMashapeKey()

Dealing with credentials:

For when you want to upload images to an account.

// Setting
imgur.setCredentials('[email protected]', 'password', 'aCs53GSs4tga0ikp');

Uploading files; globbing supported:

// A single image
imgur.uploadFile('/home/kai/kittens.png')
    .then(function (json) {
        console.log(json.data.link);
    })
    .catch(function (err) {
        console.error(err.message);
    });

// All jpegs in a specific folder
// to an album you own
var albumId = 'F8KTV';
imgur.uploadFile('/home/kai/*.jpg', albumId)
    .then(function (json) {
        console.log(json.data.link);
    })
    .catch(function (err) {
        console.error(err.message);
    });

// Multiple image types from home folder
imgur.uploadFile('~/*.(jpg|png|gif)')
    .then(function(json) {
        console.log(json.data.link);
    })
    .catch(function (err) {
        console.error(err.message);
    });

Fetching image data:

var kittenPic = 'mbgq7nd';
imgur.getInfo(kittenPic)
    .then(function(json) {
        console.log(json);
    })
    .catch(function (err) {
        console.error(err.message);
    });

Fetching album data:

var kittenAlbum = 'mbgq7nd';
imgur.getAlbumInfo(kittenAlbum)
    .then(function(json) {
        console.log(json);
    })
    .catch(function (err) {
        console.error(err.message);
    });

Creating an album:

imgur.createAlbum()
    .then(function(json) {
        console.log(json);
    })
    .catch(function (err) {
        console.error(err.message);
    });

Uploading URLs of images hosted elsewhere:

// Include http(s) when specifying URLs
imgur.uploadUrl('https://octodex.github.com/images/topguntocat.png')
    .then(function (json) {
        console.log(json.data.link);
    })
    .catch(function (err) {
        console.error(err.message);
    });

Uploading Base-64 encoded images:

var imgurFavicon = 'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAmUlEQVQ4je2TsQ3CMBBFnxMa08WR2IQKJskIUNwMZAcYwWIQMs65JCUpEEIYW4pJy6v+6e6+/hVnnGsAzsCBMi7AsbbW/rIMsAU2xrnmkeruuzW7zgIw+JGbv6fGQpWzfy3HOsJlDQY/AlCv3jpF9oS5ZBOICKoB1YCIlCdQDR9127qyBHP5Gyw3CBXPr/qi709JHXE1S995AsqoJu8x78GsAAAAAElFTkSuQmCC';

imgur.uploadBase64(imgurFavicon)
    .then(function (json) {
        console.log(json.data.link);
    })
    .catch(function (err) {
        console.error(err.message);
    });

Uploading multiple images:

Upload an array of images of the desired upload type ('File', 'Url', 'Base64').

Returns an array of images (imgur image data).

imgur.uploadImages(images, uploadType /*, albumId */)
    .then(function(images) {
        console.log(images);
    })
    .catch(function (err) {
        console.error(err.message);
    });

Uploading an album:

Create a new album and upload an array of images of the desired upload type to it ('File', 'Url', 'Base64').

Returns an object with the album data and an array of images { data: {...}, images: [{...}, ...]}.

The third parameter is an optional fail safe, meaning if the array of images is empty or invalid, it will not fail, but returns an object with empty data and empty images.

imgur.uploadAlbum(images, uploadType /*, failSafe */)
    .then(function(album) {
        console.log(album.data, album.images);
    })
    .catch(function (err) {
        console.error(err.message);
    });

Deleting anonymous uploads

Delete an image based on the deletehash(generated during the image upload)

imgur.deleteImage(deletehash)
    .then(function(status) {
        console.log(status);  
    })
    .catch(function(err) {
        console.error(err.message);
    });

License

MIT