Steps to sync a bucket to a local folder using APIs
Gather the list of local files with size and md5sum
Remove the files that you do not want to upload
Gather all the current entries in Bucket with Get Entries
Loop over get entries until content-range: x-y/z where y=z
Loop through every remote file
If a remote file path exists in the local list add it to the add/update list
If it does not exist, add it to the delete list
Loop through the local file list
If that file does not exist in the remote list add it to the add/update list
Loop through the add/update list
Use the Create or update entry by path to create or update an entry (if you wish to create a release, make sure to save this entryid and versionid in a separate release entry list)
There are two content-types supported for uploading content for an entry. One is
“multipart/form-data” and the other is “application/offset+octet-stream” which uses the tus
protocol. We recommend using tus protocol with content-type “application/offset+octet-stream”
as it supports resumable uploads. Please refer https://tus.io/ for more details.