Skip to content

Instantly share code, notes, and snippets.

View htr3n's full-sized avatar

Alex T. htr3n

View GitHub Profile
'use strict';
exports.handler = async (event, context, callback) => {
const result = {
body: null,
isBase64Encoded: false,
statusCode: 200
};
console.log('Received a render request event');
try {
{
"name": "node-canvas-lambda-container",
"version": "1.0.0",
"dependencies": {
"canvas": "^2.8.0"
},
"license": "MIT"
}
@htr3n
htr3n / nodejs_base64.js
Created November 4, 2021 21:58
Create an object from a base64 encoded input JSON string in Node.js
const inputStr = ... ; // a base64 encoded string
if (inputStr) {
const decodedStr = Buffer.from(inputStr, 'base64').toString('utf8');
const result = JSON.parse(decodedStr);
if (result) {
// ...
}
}