Closed victor-gabou closed 2 years ago
Data URI is a way to directly include the data in-line in your web page. So it is pretty convenient if you'd like to store eg images as you can directly display the result of the service without requiring the image file to be publicly available.
I think raw data buffer is more adapted if you'd like to store things not to be directly displayed eg a PDF. You can then create a blob directly from the buffer to provide the user with a way to download it.
Maybe another difference is about the protocol which is best adapted to both approach. When using websocket you don't really have any problem to transfer a big buffer but when using raw HTTP it can be more complicated and requires multipart upload, which might be more easy to deal with using data URI. However I am not sure about that as you can use a blob with a raw buffer in a multipart upload.
Thanks a lot for these informations!
To sum up, as I'm working on a generic file input, the best would be to return files as data uri as it's more convenient with a rest approach (and not problematic with sockets) + it allows me to display selected files (if images) directly before submitting them to server. For the file download case, as it's not complicated to transform data uri to blob on client I don't think that I should take this into consideration.
Does this sound like the right approach to you?
That's exactly what I am doing actually, so it sounds good to me ;-)
Perfect, thanks for your replies :)
Hello,
Not a bug here :)
I was just wondering what are the difference between using data uri or raw data buffer
I've been using feathers-blob for several years and as I always used the feathers doc when starting a project, I've used data uri every times.
But as I'm starting a new project, I wonder if raw data buffer is better (or worst) than data uri and what are the pros and cons.
My main concern is performances.
Thanks for your work!