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

@amonks/media-uploader

v1.0.8

Published

This is for when you want to upload some media to s3 but also tell your API some metadata about that media. You say "Hey API! Got a file for ya! Also, here's some metadata!" the api says "Cool! I'll keep the metadata. Here's a signature for sending the fi

Readme

Media Uploader

This is for when you want to upload some media to s3 but also tell your API some metadata about that media. You say "Hey API! Got a file for ya! Also, here's some metadata!" the api says "Cool! I'll keep the metadata. Here's a signature for sending the file straight over to s3!" Then, you send the file to s3. Great!

Install

First, install nodejs.

Then, from the command line,

npm install --global @amonks/upload-media

Configure

You can configure Media Uploader using environment variables.

These environment variables are required:

  • UPLOAD_MEDIA_API_KEY
  • UPLOAD_MEDIA_ENDPOINT_URL

You can also pass metadata to the server by using additional environment variables that begin with UPLOAD_MEDIA_METADATA_.

Use

From the command line

Once you've installed this module, you can use it from the command line. This works on Windows.

upload-media my-picture.jpg

One way of setting the required environment variables is like this:

UPLOAD_MEDIA_API_KEY="abc123" UPLOAD_MEDIA_ENDPOINT_URL="https://whatever.com/upload" upload-media my-picture.jpg

Another way is to make a file called .env. That file has to be in whatever folder you call upload-media from. It should look like this:

UPLOAD_MEDIA_API_KEY="abc123"
UPLOAD_MEDIA_ENDPOINT_URL="https://whatever.com/upload"
UPLOAD_MEDIA_METADATA_MEDIA_TYPE="Polaroid"

As a JavaScript Library

If you're using javascript, you can use this as a library like this:

const uploadMedia = require("@amonks/upload-media");

uploadMedia("path-to-my-file.mp4").then((success, err) => {
  if (error) throw Error("Error uploading media!\n" + error.message);
  console.log("Success!");
});

What it does

It makes two requests. First, it sends an HTTP request to the UPLOAD_MEDIA_ENDPOINT_URL:

POST /upload HTTP/1.1
x-api-key: abc123
accept: application/json
content-type: application/json
accept-encoding: gzip,deflate
connection: close
content-length: 114
Host: whatever.com

{"contentLength":361,"contentType":"application/json","uuid":"ffdf5a2c-f28d-4b67-b1d4-cdd5af58a6dc","metadata":{"mediaType":"Polaroid"}}

It expects to receive a response like this:

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 926
Connection: close

{"version":"1.0","responseId":"49cca5e7-9283-4099-9ed3-9b323d5c3a5d","sentAt":"2018-06-05T07:07:32.584Z","status":"ok","data":{"signedRequest":"https://xxxxxxxxxxxxxxxxxxxx-media-uploads.s3.us-west-2.amazonaws.com/ffdf5a2c-f28d-4b67-b1d4-xxxxxxxxxxxx/hhhhhhhhh?AWSxccessKeyId=ASIAIFNO2XZXXXXXXXXA&Content-Type=image%2Fjpeg&Expires=1528183351&Signature=NN2XXXXXXXXXXXXXR4QAGD71u3g%3D&x-amz-security-token=FQoDYXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXkYeP5N10WNrd9otA4HvCtSVSgyFJLws3FW9GqU4CpU5DM7qO678YSpWdNJp3u%2BPjUnzQsC6apSN2jKKAD9tJBYOhNjPlpdBEt1KjlZbcCOmWjU4IU4cFw%2FnhTVVy7Zoe9%2FVLt3BT9Tls44iElxNzngHl7tMFXVOCORaG6A%2Fvx0mwzJGLkLOPpzb5YD97de%2BvbnGAE4SiAx9jYBQ%3D%3D","key":"ffdf5a2c-f28dxxxxxxxxxxxxxxxxx58a6dc/undefined","bucket":"whatever-media-uploads"}}

It then PUTs the file to the url from the signedRequest field of the response.