Тёмный

I Found a BETTER Way to Do File Uploads 

James Q Quick
Подписаться 204 тыс.
Просмотров 16 тыс.
50% 1

Опубликовано:

 

5 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 32   
@DanielAWhite27
@DanielAWhite27 7 месяцев назад
A big thing here that is missing is the transactional safety of this. I treat all my endpoints/requests as a transactional boundary. If using a second request, the onus is on the client to do more work that still can fail, and your data source wouldn’t be any wiser. It looks like that db has the capability to make sure things are “complete” but not out of the box using s3. It also isn’t free. It’s shifting from one cost to another
@thewildweb
@thewildweb 7 месяцев назад
Hey can you briefly help me to explain via blog or example that will be very helpful
@playboycity
@playboycity 2 месяца назад
We are using signed uploads at work and at one point to frontend would show the upload was complete but the file didn’t make it to S3, as stated this is not free
@davefox2257
@davefox2257 7 месяцев назад
We had done something similar, but you have to add the extra step of upload confirmation. If there was an error on upload, the entry still exists on the db. This caused name already exists errors. It ends up being two to three steps depending on if all goes well or not.
@sergi0YT
@sergi0YT 6 месяцев назад
This is what I have implemented a while to upload files from a mobile device. Lambda creates an url for the file, sign it for write access and then you can just POST the file from the phone. All network load is on S3 now.
@JustinSBarrett
@JustinSBarrett 8 месяцев назад
Really informative video, but there was one piece I was hoping for but didn't see: what's the process of creating a signed upload URL? Is that something that Xata (and other storage systems) do for you, or is there more code needed for that part?
@DanielAWhite27
@DanielAWhite27 7 месяцев назад
AWS S3 has an api for your backend to create these
@naterpotatoers
@naterpotatoers 8 месяцев назад
Interesting idea I’ve not heard before. Now I’m curious if you have any ideas on live video streaming and your approach to how to handle that - thanks
@johnaroj
@johnaroj 8 месяцев назад
Nice approach. I was doing something like that but in a different order. I send everything in one call and immediately return the name and a screenshot using ffmpeg. which will return a image and status pending. in the background will process the files without waiting for the server to respond. And with this process you can choose to request the progress in the background or just refresh the page manually to see if data is ready
@polkulotznad3987
@polkulotznad3987 5 месяцев назад
how
@Rapid-eraser
@Rapid-eraser 8 месяцев назад
This does not look as a generally BETTER Way, more like an other way I would say :) I dont see any gain to small projects ... If you are build a YT clone you should have already have the resources required. Also in EU you are probable would have lots of problems regarding GDPR, you may have to sign a GDPR agreement with the third party service handling the storage ... looks like hell already.
@naterpotatoers
@naterpotatoers 8 месяцев назад
From my understanding this seems more performant in that you aren’t passing all of your data through your middleware essentially ? Dunno anything about gdpr tho
@9903918500
@9903918500 8 месяцев назад
why can't we do fs.unlinkSync to the filepath after we finished uploading the file to our blob storage ? this can stop the need to store any data within the server itself.
@stephenpaulhassall
@stephenpaulhassall 8 месяцев назад
That is super cool and very impressive. 👍
@skapator
@skapator 7 месяцев назад
Feel this is smart and has a couple of use cases that can be applied. But really not a new idea at all. At the end you are switching costs and introduce error creeps. An enterpize app will have storage on their servers. The main issue is that this simplified example of just a video upload with a filename/path is never the case in real production. From video manipulation, validation transactional integrity, queueing, background tasks, this is going to be a nightmare to split and handle unhappy paths. Makes sense if you are renting every bit of a small app and have no infra at all but not really an issue in real prod. This "renting all" mentality of the past few years is actually costing more on small apps where all of these concerns seem like premature opt. If we look at actuall full stack frameworks, these cost/issues are non existent.
@siya.abc123
@siya.abc123 8 месяцев назад
Good tips, thanks for sharing
@kamill34
@kamill34 8 месяцев назад
I've tried serverless function, and I think the limitiation is 4 mb
@ardianhotii
@ardianhotii 8 месяцев назад
Is this the same logic using cloudinary ?
@tomich20
@tomich20 8 месяцев назад
never heard of signed urls. Question.. if i rquest to upload a 2kb mp4 video, get the URL, and then continue to upload my 4GB full hd pirate movie to that URL, would that work? seems risky to give the power to the client.
@jesper.ordrup
@jesper.ordrup 8 месяцев назад
would like to know too
@nightshade427
@nightshade427 8 месяцев назад
Does this leave you open to security issues? You are telling the client where all your videos live and how to access them directly. If the backend is s3 for example and policies aren't setup perfect could it lead to issue?
@DanielAWhite27
@DanielAWhite27 7 месяцев назад
Usually the upload url is opaque
@racquad
@racquad 8 месяцев назад
But what if I need to post process the file? Let's say from a video I need to create lighter versions of it (360p, 480p etc.). Or if it's an image I then need to save the master for later and then create a thumb and a lighter 1024px version of it? I need to go to my blob repository anyway, fetch the master file and process it, right?
@gajrajsingh51
@gajrajsingh51 8 месяцев назад
Send a request to server to tell them the upload is complete
@racquad
@racquad 8 месяцев назад
@@gajrajsingh51 That's for sure. But my point is that server will need to download the full file anyway to run the post processes anyway. So you can either upload directly to S3 if you just need to save the file or you can upload to server and then server will produce derivative low quality versions and upload afterwards.
@ErikMeliska
@ErikMeliska 8 месяцев назад
Good question, there was a commented code about transcribing the video, I wonder, how this would be done, without having physical data on the server.
@arupde6320
@arupde6320 8 месяцев назад
github link ??
Далее
git rebase - Why, When & How to fix conflicts
9:45
Просмотров 51 тыс.
V16 из БЕНЗОПИЛ - ПЕРВЫЙ ЗАПУСК
13:57
20+ AMAZING VS Code Tips I Wish I Knew Earlier
15:52
Просмотров 24 тыс.
Did Theo Really Fix File Uploading?
8:39
Просмотров 19 тыс.
I Stopped Using Express.js: Because Bun and Hono 🔥
10:23
A YouTuber Stole My Project (And I'm HYPED)
15:13
Просмотров 47 тыс.
The Most Important Skill You Never Learned
34:56
Просмотров 208 тыс.
V16 из БЕНЗОПИЛ - ПЕРВЫЙ ЗАПУСК
13:57