Closed thomasreichmann closed 2 months ago
uppy
functionality (will become operations)these came from https://github.com/thomasreichmann/aws-file-manager
POST /api/upload/presign
uploadId
and key
.{
"filename": "string",
"storageClass": "string (optional)"
}
{
"uploadId": "string",
"key": "string"
}
GET /api/upload/presign
filename
: The file name.uploadId
: The upload ID from the multipart upload.partNumber
: The part number.PUT /api/upload/presign
{
"uploadId": "string",
"parts": [
{ "ETag": "string", "PartNumber": number }
],
"filename": "string"
}
{
"message": "statusCode"
}
DELETE /api/upload/presign
uploadId
: The upload ID to be aborted.key
: The file key (filename).GET /api/upload/parts
uploadId
: The upload ID.key
: The file key (filename).[
{
"PartNumber": number,
"ETag": "string"
}
]
Hook is now created, mostly working and still needs a lot of improvements, but the requirements that this issue outlined are mostly completed. The rest will become individual tickets now that uploading actually works at least
useUpload Structure
1. Client Requirements
What users of this hook will need:
Method to start an upload
Takes a list of files & options. The options should be optional. For custom uploads, a
options
object can be passed with the desired values, potentially coming from user config. This allows any option that makes sense to be configurable to be added to the user settings, or later something else.status
object (state) to track upload progressThis tracks the current progress of the upload. We could provide individual objects for each status type (e.g., speed, remaining bytes, total time, estimated time), rather than a single
status
object with all of them. This avoids unnecessary state updates if not all statuses are consumed. However, since clients might need or care about all statuses, this might not be necessary (still worth thinking about tho).Methods to control the upload
Includes actions like cancel, pause, and resume. These can be encapsulated in an
uploadController
object returned by the hook, which contains all of the control methods (maybe it makes more sense for an upload controller to be returned each time we "start an upload")(maybe not, since each instance of the hook should have it's own upload queue, so it really is a global controller for that instance, and calling the upload method twice will just queue more files).