Last active
May 3, 2018 20:11
-
-
Save drexler/e020355d5799afb3ec8d4f5dcf51825a to your computer and use it in GitHub Desktop.
uploading strategies
This file contains hidden or 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
Show hidden characters
// Option one: directly upload base64 encoded files | |
// Pros: one network trip | |
// Cons: large attachments might cause processing delays and eventual lambda timeout | |
POST /tenants/{tenantId}/uploads | |
{ | |
"items": [ | |
{ | |
"filename": "someLogo", | |
"filenameWithExtension": "someLogo.ext", | |
"payload": "base64encodedString" | |
}, | |
{ | |
"filename": "toysRus", | |
"filenameWithExtension": "toysRus.ru", | |
"payload": "base64encodedString" | |
} | |
] | |
} | |
// Option two: request a presigned url for uploads | |
// Pros: one url to use to upload to S3 directly, no timeouts involved | |
// Cons: requires 3 network trips for uploads to be done | |
POST /tenants/{tenantId}/presignedUrl | |
{ | |
"use": ["download"|"delete"|"upload"], | |
"item": { | |
"filename": "toysRus", | |
"filenameWithExtension": "toysRus.ru", | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment