Skip to content

Commit

Permalink
Add support for bulk downloads
Browse files Browse the repository at this point in the history
  • Loading branch information
xsalazar committed Oct 1, 2023
1 parent 6d85184 commit 453ae19
Show file tree
Hide file tree
Showing 2 changed files with 844,125 additions and 842,247 deletions.
23 changes: 23 additions & 0 deletions app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,29 @@ exports.handler = async (event, context) => {
console.log(JSON.stringify(event));
const bucketName = "xsalazar-emoji-kitchen-data";

// Handle bulk download requests
if (
event.queryStringParameters &&
event.queryStringParameters.imageSource &&
event.queryStringParameters.imageSource.startsWith(
"https://www.gstatic.com/android/keyboard/emojikitchen"
) &&
event.requestContext.http.method === "GET"
) {
// Get image from internet
var response = await axios.get(imageSource, {
responseType: "arraybuffer",
});

return {
cookies: [],
isBase64Encoded: true,
statusCode: 200,
headers: { "content-type": "application/octet-stream" },
body: Buffer.from(response.data, "binary").toString("base64"),
};
}

if (event.requestContext.http.method === "GET") {
const s3 = new AWS.S3();

Expand Down
Loading

0 comments on commit 453ae19

Please sign in to comment.