Skip to content

Instantly share code, notes, and snippets.

@manan-jadhav
manan-jadhav / generateAwsSesSmtpPassword.js
Last active September 20, 2022 18:11
Generate AWS SES SMTP Password from AWS Access Key
/*
When using AWS SES and attempting to send emails over SMTP using
an custom IAM user, the user needs to have the SendRawEmail permission.
The SMTP username is the AWS Access Key ID while the SMTP password must
be calculated using a *special* (ahem, ahem) algorithm mentioned in AWS
docs here: https://docs.aws.amazon.com/ses/latest/dg/smtp-credentials.html
This function is a Node.js compliant port of the pseudocode mentioned on
that page.
@manan-jadhav
manan-jadhav / node-rm-rf.js
Created May 7, 2016 04:05 — forked from geedew/node-rm-rf.js
Removing a directory that is not empty in NodeJS
var fs = require('fs');
var deleteFolderRecursive = function(path) {
if( fs.existsSync(path) ) {
fs.readdirSync(path).forEach(function(file,index){
var curPath = path + "/" + file;
if(fs.lstatSync(curPath).isDirectory()) { // recurse
deleteFolderRecursive(curPath);
} else { // delete file
fs.unlinkSync(curPath);
}