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

dropdot

v0.1.0

Published

Simple file uploading application

Downloads

29

Readme

Dropdot

Dropdot is a simple file uploader built on NodeJS, Express and S3 API as the object storage platform. It supports AWS S3 and DreamHost Objects as storage provider.

Configuring Dropdot is simple, just follow the steps below:

AWS S3 Demo: http://dropdot.herokuapp.com/

Deploy

Installation

Clone and install dependencies

$ git clone https://github.com/alfg/dropdot.git
$ cd dropdot
$ npm install

Open config.js and configure

module.exports.port = 3000; // App port
module.exports.aws_key = "YourAWSKey"; // AWS Key
module.exports.aws_secret = "YourSuperSecretAWSKey"; // AWS Secret
module.exports.aws_bucket = "NameOfS3Bucket"; // S3 bucket
module.exports.redirect_host = "http://localhost:3000/"; // Redirect page after successful upload
module.exports.host = "YOUR_S3_PROVIDER"; // S3 provider host
module.exports.bucket_dir = "uploads/"; // Subdirectory in S3 bucket where uploads will go
module.exports.max_filesize = 20971520; // Max filesize in bytes (default 20MB)

Or set your environment variables:

export PORT=3000
export AWS_KEY=<YourAWSKey>
export AWS_SECRET=<YourSuperSecretAWSKey>
export AWS_BUCKET=<NameOfS3Bucket>
export REDIRECT_HOST=http://localhost:3000/
export HOST=<YOUR_S3_PROVIDER>
export BUCKET_DIR=uploads

Run the app

$ node app.js

Load http://localhost:3000 into the browser

The app is set, now you need to create and configure your S3 Bucket.

Configuring your S3 Bucket

In order to allow S3 to accept CORS uploads from your app, it needs to be properly configured.

AWS S3

Log into your S3 Console and create a bucket.

Right-click your bucket and go to properties > permissions > Edit CORS Configuration.

Enter the following:

<CORSConfiguration>
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>PUT</AllowedMethod>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>POST</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
        <AllowedHeader>*</AllowedHeader>
    </CORSRule>
</CORSConfiguration>

Of course, the * in AllowedOrigin is only for development. Be sure to use your domain when going public.

DreamObjects S3

See: https://help.dreamhost.com/hc/en-us/articles/216201557-How-to-setup-Cross-Origin-Resource-Sharing-CORS-on-DreamObjects

CNAME your S3 bucket (optional)

Objects will be available by accessing the public URL directly. Example: http://bucket-name.s3.amazonaws.com/uploads/439fbca8-b79b-40e9-8172-4d318737ee14_file.jpg

However, if you wish to customize the URL, you can use a CNAME. First, create/rename your bucket to match the subdomain (uploads.domain.com). Then create the CNAME (via your DNS settings) using the exact name of the bucket/subdomain.

To be clear, the bucket's name and CNAME should be identical. i.e. uploads.domain.com

You can now access your files as: http://uploads.domain.com/uploads/439fbca8-b79b-40e9-8172-4d318737ee14_file.jpg

That's it!

All done! Now go upload stuff.

License

Dropdot is open-source under the MIT License.

Credits

Dropdot uses the following technologies, check them out!

  • NodeJS The core backend
  • Express Framework for Node. Serves the JSON policy
  • mime Mime-type detection
  • crypto Used for SHA1, Base64 digestion
  • uuid Generating the unique IDs
  • Amazon S3 Cloud Object/File Storage Platform

Guides that saved me a few gray hairs dealing with CORS:

  • http://pjambet.github.com/blog/direct-upload-to-s3/
  • http://aws.amazon.com/articles/1434