This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func streamToByte(stream io.Reader) []byte { | |
buf := new(bytes.Buffer) | |
buf.ReadFrom(stream) | |
return buf.Bytes() | |
} | |
// pass reader to NewDecoder | |
dec := base64.NewDecoder(base64.StdEncoding, strings.NewReader(base64string[i+1:])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AWS = require("aws-sdk"); | |
AWS.config.update({ | |
accessKeyId: "", | |
secretAccessKey: "", | |
region: "us-west-2" | |
}); | |
var s3 = new AWS.S3(); | |
var bucketName = "movieinfos3"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<p>This topic describes how to Create AWS Lambda Node.js function that gets all images from S3, and deploy it into AWS API Gateway.</p> | |
<p>Scenario: </p> | |
<p>In S3 has the object contains the images arranged by movieid(folder) like:</p> | |
<div class="text-center"><img src="https://s3-us-west-2.amazonaws.com/baodinh.blog/gateway/15.png"/></div> | |
<p>I want to create api to access all of the images by movieid. So the result api will be like this:</p> | |
<pre>https://z5d4qclzwd.execute-api.usest2.amazonaws.com/movie/getimages?id=207932 </pre> | |
<div class="text-center"><img src="https://s3-us-west-2.amazonaws.com/baodinh.blog/gateway/1.png"/></div> | |
<p>This documentation guides you through our simple Node.js Lambda example function in detail.</p> | |
<p>Note: Strongly suggests you familiarize yourself with <a href="http://docs.aws.amazon.com/lambda/latest/dg/programming-model.html">Programming Model (Node.js)</a> in the AWS Lambda Developer Guide before continuing.</p> | |
<p>Example content:</p> |