I have a simple command line tool that fetches preview images from a remote location and uploads to Filestack every time it runs, even if the images had been uploaded in previous runs. Is there a standard way I can check if a file already exists in Filestack before attempting an upload?
Options I'm considering:
One option would be to make HTTP HEAD request to the potential Filestack file URL, but AFAIK that's only possible if I have the Filestack image handle/key from the previous run.
The other option would be to :
- Store preview image id <> Filestack handle/key in a serializable map every time a new image is uploaded
- Serialize the map when the run is done
- At the beginning of the next run deserialize the map so I have an idea of was uploaded.
I just want to know if there's a better or Filestack(standard) way of doing this other than the options I'm considering.