Skip to content

Instantly share code, notes, and snippets.

@yuvraj108c
yuvraj108c / sleep.js
Created May 9, 2022 06:07
[js] Sleep for N miliseconds
const sleep = async (milliseconds) => {
await new Promise((resolve) => setTimeout(resolve, milliseconds));
};
@yuvraj108c
yuvraj108c / upload_s3.js
Created May 4, 2022 09:10
Upload file to s3 from nodejs
const axios = require("axios");
const AWS = require("aws-sdk");
AWS.config.region = "us-east-1";
const bucket_id = "BK-1";
module.exports.main = async (event) => {
const s3 = new AWS.S3();
await s3
.putObject({
@yuvraj108c
yuvraj108c / invoke_lamda.js
Created May 4, 2022 09:04
Invoke lambda function from nodejs
import AWS from "aws-sdk";
AWS.config.region = "us-east-1";
(async () => {
const lambda = new AWS.Lambda();
const params = {
FunctionName: "FN-1",
InvocationType: "RequestResponse",
LogType: "Tail",
Payload: