Recreate Parse.File object from its URL

I have some URL strings of files that were originally constructed by saving data via the Parse.File API, but the Parse.File objects were not preserved. The data is still in the database (AWS, but this should not matter here) and accessible from the URLs.

Is there a way of recreating the Parse.File objects using these URL strings? AFAIK the API does not directly allow this: file objects apparently are either created from data or fetched from the db.

The only workaround I can think of is to 1) download each file URL, 2) re-upload the data to create a new file object, and 3) delete the old file URL. Should work but doesn’t seem especially elegant :nerd_face:

Any help appreciated :slight_smile:

  • What is the reason for uploading the same existing file again?
  • Did you make a server change? Do you want to provide access through a new URL?

Can you write a more explanatory reason?

Hey :slight_smile:

It’s not about re-uploading files, the file data is still there – as I have written in my original question: All I want is to recreate a ParseFile object using the still existing URL that points to the still existing data.

The only available public constructor of ParseFile is:

new ParseFile(name, data, type, metadata, tags)

However, I need something like this:

new ParseFile(url)

… where url is a URL to a file that already is present in the Parse server’s file store.

Obviously that’s not possible via the SDK. I’d be happy with a hacky way to achieve this since I only need it for a single migration task, where I plan to recreate file objects based on existing file store URLs, and save them in a property of a Parse class.

Best regards,