Skip to content

Instantly share code, notes, and snippets.

View monogot's full-sized avatar
🎯
Focusing

Kirati Samatthanares monogot

🎯
Focusing
View GitHub Profile
@monogot
monogot / userAvatar.js
Created December 13, 2022 17:11 — forked from SylarRuby/userAvatar.js
NodeJs AWS S3 Upload
/**
* This gist was inspired from https://gist.github.com/homam/8646090 which I wanted to work when uploading an image from
* a base64 string.
* Updated to use Promise (bluebird)
* Web: https://mayneweb.com
*
* @param {string} base64 Data
* @return {string} Image url
*/
const imageUpload = async (base64) => {
@monogot
monogot / deleteAvatar.js
Created December 13, 2022 17:11 — forked from SylarRuby/deleteAvatar.js
Deletes a s3 bucket object by a known unique key 💥
/**
* Delete an image from the S3 Bucket
*
* @author Daveyon Mayne <@MirMayne>
* @date July 14th 2019
*/
const AWS = require('aws-sdk');
const deletePhoto = async (avatar_url) => {