https://github.com/ogwurujohnson/aws-s3-node-file-upload
An aws s3 image upload package, comes with image compression if you so choose to use this feature
https://github.com/ogwurujohnson/aws-s3-node-file-upload
aws compression image-upload s3-bucket
Last synced: 27 days ago
JSON representation
An aws s3 image upload package, comes with image compression if you so choose to use this feature
- Host: GitHub
- URL: https://github.com/ogwurujohnson/aws-s3-node-file-upload
- Owner: ogwurujohnson
- License: mit
- Created: 2020-03-16T23:11:24.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-12T09:44:58.000Z (over 3 years ago)
- Last Synced: 2025-09-16T08:41:53.972Z (9 months ago)
- Topics: aws, compression, image-upload, s3-bucket
- Language: JavaScript
- Homepage:
- Size: 254 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# AWS S3 IMAGE UPLOAD
> An aws s3 image upload package, comes with image compression if you so choose to use this feature
> Note: This package is in no way endorsed by AWS, but is a little pet project of mine i wish to make big one day
## Install
```javascript
npm i file-upload-s3
```
```javascript
yarn add file-upload-s3
```
## How to use
```
const express = require('express');
const formidable = require('formidable');
....
const AWS = require('file-upload-s3');
const upload = new AWS.Upload({
access: '',
secret: '',
region: '',
bucket: ''
});
......
app.post('/upload', async (req, res) => {
let form = new formidable.IncomingForm();
form.parse(req, async function(err, fields, files) {
if (err) {
console.error(err.message);
return;
}
const img = await upload.uploadFile(files.image, false, true) // (a, b, c)
// a = 'image to be uploaded'
// b = 'bucket name if you haven't provided it in the initialization earlier
// c = 'compress, if true, the image would be compressed before sent off to aws s3,
false, the image won't be compressed'
res.json(img)
});
})
```
## Dev Server
```javascript
npm run start
```
```javascript
yarn start
```
## Production Bundle
```javascript
npm run build
```
```javascript
yarn build
```
### Follow me on Twitter: [@devopsjay](https://twitter.com/devopsjay)