node package manager

stream-uploads

stream-uploads

Build Status npm version

A node.js package that allows you to easily stream uploads to s3. It provides the endpoints, configuration, and middleware to get you up and running stat.

Install

npm install stream-uploads

Usage

Configure your s3 bucket with:

process.env.S3_BUCKET_NAME = 'your-bucket'

Simply attach the provided router and start accepting streaming uploads at '/uploads':

const app = require('express')()
const streamingUploadsRouter = require('stream-uploads').router
 
app.use(streamingUploadsRouter)
 
app.listen(3000)

Or make your own custom implementation using the uploadHandler middleware:

const express = require('express')
const app = express()
const uploadHandler = require('stream-uploads').uploadHandler
 
 
app.post('/upload', uploadHandler, (req, res) => {
 
  // Do stuff here ... 
 
}

uploadHandler

A group of Express.js middleware that configures multer, uploads, and reports the errors of attempted uploads to s3 to the client.
  • @param {object} req
  • @param {object} res
  • @param {function} next