Back

What does `getFileView` do in Node?

  • 0
  • Storage
wintercounter✌🏼
8 Oct, 2023, 15:45

I'm using getFileView on client side to generate a URL for my images. I want to do the same in Node, but there it returns a File buffer instead of an URL Object. The docs is really unhelpful with this.

TL;DR
The user is asking about the purpose of `getFileView` in Node and is confused about its behavior compared to the client-side API. They mention that the endpoint is usually stored in an environment variable or constants file. The user also mentions that they are currently constructing the URL manually and need a solution for generating URLs on the server-side. The user is frustrated with the lack of helpful documentation.
Drake
9 Oct, 2023, 05:30

It returns the file buffer

wintercounter✌🏼
9 Oct, 2023, 07:05

Yes, that's my problem. It's inconsistent to the client side API. How am I supposed to get the URL of a file? Now I'm constructing the URL on my own, and I need to hardcode my site's URL.

Drake
9 Oct, 2023, 13:42

The web sdk is the only one that returns a url because that's how it's done in web

Don't you have the endpoint in some variable?

wintercounter✌🏼
9 Oct, 2023, 13:43

What difference does it make if I put in in a variable? It's still hardcoded...

Drake
9 Oct, 2023, 13:44

Typically, the endpoint is in some env variable or constants file so it's not really hardcoded.

Anyways, we do have plans to add a separate method: https://github.com/appwrite/sdk-generator/issues/557

wintercounter✌🏼
9 Oct, 2023, 14:03

even if I put out in env var, I have to go an change if I move to another domain. anyway, i'm glad to hear there are pans to support this

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more