Parse File image , actual location on server?

Hi Team,

  1. What is the actual location of parse files on the parse server on linux ?

  2. How to remove it all manually from server ?

  3. Instead of using a parse-file Can I directly store the base64 string in the table column and directly
    decode at the client-side?

  4. Bellow is the correct method for JS SDK to store files into the table?

    const newEntry = new Parse.Object(“Students_” + schoolId);
    const base64 = “base64string”
    const parseFile = new Parse.File(“student.png”, { base64: base64 });
    let newfile = await parseFile.save()
    newEntry.set(“photo”, newfile);
    return newEntry.save()

We need to hold thousands of student photos in student table .

1 Like
  1. Depends on your file adapter. By default, it stores in the MongoDB database.
  2. parseFile.destroy()
  3. Yes, you can, but I’d rather use Parse Files. Storing large data in each of your User objects can reduce performance for other operations in this class.
  4. Looks good

Hi @davimacedo ,
thanks for the response I have one more question.
I want to give functionality to download all photos of the students (parse file ) But before downloading, I want to rename the filename with student objected, is there any way to do so?

OR
alternatively Is there any way to store a file with a custom file name like can I use objectId as the file name to do so ? or may be any unique no. , so we can use that name directly while downloading,

As peer as the code you sent, you can set the file name when creating it.

Hi @davimacedo ,
Yes, I did but At the time of retrieve, I am getting below response from the parse server. which contain a long file name.

I didn’t get it. What’s the problem with this response?

The problem is that we want a short filename like CTwOktIu8p.jpg or 314846545.jpg or something short unique code.
To achieve that I am passing the filename while saving it but when I retrieve that object I got an above-mentioned response with a long unique filename.
Is it possible to achieve this?

Parse Server by default adds a unique identifier in the beginning of the file name. It can be disabled using preserveFileName option.

1 Like

Hi @davimacedo
It Works I have set it in the Server config and started accepting the given filename with its unique Id like uid_myfilename.jpg. It helps a lot Thanks for the guidance and quick response to understand the parse server.

Hi @davimacedo

  1. May I know the use of the File adaptor, just to store files in the desired location on the server? rather than storing objects on Mongodb?
    or there are many other advantages to using it? is there any good example to how to better config it?

  2. Is there any way to create multiple parse files (images) in bulk as we need to import 2k - 3k photos and store theme against each row in table.

1 - I’d not recommend storing a large amount of files on mongodb for production app. It’s better to go with another adapter, such as s3 adapter.
2 - I’m not aware of any batch method for that.

Hi @davimacedo , can I hold maximum 90k file using parse.file and store in mongodb without using any adapter? For production app. As you suggest us to use s3 adapter. Maximum size of one file will be 150kb minimum 30kb . Please share your thoughts on it.

I’d not use MongoDB for that.

1 Like

Pardon for asking again, may I know the reason behind it. As we already integrated files things using default prase file logic with so bit worry.

You will overload your database (which usually requires a more expensive infrastructure and it’s harder to scale) to store files that could be easily be stored in a storage specific for files, such as AWS S3. While storing directly into the database is a more convenient solution, using a fit for purpose storage will turn out being cheaper, faster, and more scalable.

1 Like

using Parse Server FS Adapter , If I store all files on my server rather than in DB, will it help at some level ?
thinking of not using any third-party paid services for file storage and using our own VPS. to save some bucks.

I don’t much about Parse Server FS Adapter, but what I understand is it helps us to create files on our server, not in DB correct me If I’m wrong.
again pardon me for asking a silly question.

Thanks a lot for your giving direction.

I’m not sure. I’ve never used an adapter that saves on local server. Do you have a link to this adapter?

Yes sure here it is
gitlink - GitHub - parse-community/parse-server-fs-adapter: parse-server file system storage adapter
npmlink - @parse/fs-files-adapter - npm

How much file will you have? Back blaze supports S3 protocol and first 10gb is free. Also 2.5gb bandwidth is free for everyday. You don’t even need to enter your credit card for this. This would be better for the future if your business grows and you need to scale further.

Also Cloudflare R2(S3 equivalent) is in open beta right now and i believe they also has first 10gb free. And they support unlimited downloads. You can take a look at that too.

1 Like