mjackson / remix-the-web

Open source tools for Remix (or any framework!)
MIT License
712 stars 14 forks source link

How to work with stored file? #25

Closed kunanyi closed 2 weeks ago

kunanyi commented 2 weeks ago

(Apologies, I'd of put this in a Discussion normally, as it's more a gap in my understanding)

Re:file storage:

Using edgefirst-dev/r2-file-storage I can get a CSV file stored

However I don't understand how to access the data in the CSV file?

"storage.get" seems to just retrieve the meta data for the file? What if I wanted to load and parse the CSV contents?

I'm not sure if that is the remit of this library? But was hoping for a straight forwards "remixy" way to do this simple thing

sergiodxa commented 2 weeks ago

Once you have a File instance if you need the content you can do await file.text() or any other standard method of File objects.

This method is inherited from the Blob class that File extends from https://developer.mozilla.org/en-US/docs/Web/API/Blob/text.

kunanyi commented 2 weeks ago

Awesome thank you!