Skip to content

Instantly share code, notes, and snippets.

View kylenstone's full-sized avatar

Kyle kylenstone

  • Save Your Generation
  • Boulder, Colorado
View GitHub Profile
@schempy
schempy / stream-file-upload-s3-nodejs.js
Last active March 11, 2024 10:20
Streaming File Uploads To Amazon S3 With Node.js
var http = require('http');
var router = require('routes')();
var Busboy = require('busboy');
var AWS = require('aws-sdk');
var inspect = require('util').inspect;
var port = 5000;
// Define s3-upload-stream with S3 credentials.
var s3Stream = require('s3-upload-stream')(new AWS.S3({
accessKeyId: '',
@mattlockyer
mattlockyer / client.js
Last active February 22, 2023 18:30
s3 upload as stream using req stream (extra info in request header)
const file = this.input.files[0];
//console.log(file);
var xhr = new XMLHttpRequest();
xhr.addEventListener('load', (e) => {
console.log(e.target.response);
});
xhr.open('POST', host + 'fileuploadstream', true);
xhr.setRequestHeader('body', JSON.stringify({ id: 'somebucketfolderid', fn: file.name }));
xhr.send(file);
@arv25
arv25 / index.js
Created September 8, 2020 14:38
Lambda calling lambda with trace id
// Lambda 1 - arv-foo
// Synchronous fn that will back API Gateway endpoint.
const AWS = require('aws-sdk');
const lambda = new AWS.Lambda();
const getRandomInt = (max) => Math.floor(Math.random() * Math.floor(max));
exports.handler = async (event, context) => {
console.log("event:", event)