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

simple-imgur-uploader

v1.0.0

Published

An attempt at making a simple imgur uploader

Downloads

4

Readme

Simple Imgur Uploader

A really simple imgur uploader, for when you don't need that much. Does not use any libraries that aren't included in nodejs (https, and querystring).
Call the uploadFileBuffer or uploadFileBufferAsync functions with your client-id, and a buffer of a file (which you can get by reading the file with the inbuilt fs module).
Does not support uploading to a user account, and don't plan to.
Goto this url to register an application with imgur: https://api.imgur.com/oauth2/addclient I believe you'll need an account on imgur.
Example code showcasing basically all the api:

let imgur = require("../ImgurUploader/index.js");

let clientID = "your-client-id";

let file = require('fs').readFileSync("./bool.jpg");

imgur.uploadFileBuffer(clientID, file, (err, data) => {
    if (err) {
        throw err;
    }
    console.log(data);
}, "image");

imgur.uploadFileBufferAsync(clientID, file, "image")
    .then(data => console.log("Async", data))
    .catch(err => console.error("Asyncerr", err));

The methods have some extra parameters for things like title, description, filename (not sure what this does on imgur), and a few others that are just passed in the request.
These todos are just thing that'd be nice to have, currently it's in an 'okay' state since it's mainly meant to be an uploader. TODO:

  • Add ability to delete files with the deletehash
  • Add ability to add it to an album (the docs say this can be done for anonymous albums if you use the deletehash)
  • Add ability to set/unset disable_audio flag in the request
  • Add ability to get image data
  • Add ability to update image info (you can use deletehash)
  • Get info about album
  • Get album images
  • Get a specific album image
  • ... basically just go through the list and hopefully support most things which don't require authentication