将大文件上传到NodeJS Web服务器 [英] Uploading large file to NodeJS webserver

查看:447
本文介绍了将大文件上传到NodeJS Web服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用NodeJS服务器(ExpressJS)来提供我的Web应用程序.新要求之一是要求用户能够将大型视频(可能以演出为单位)上传到服务器.他们稍后将能够再次下载它们.我能用当前的堆栈实现吗?

I am serving up my web application using NodeJS server (ExpressJS) currently. One of the new requirements is for the users to be able to upload large videos (potentially in gigs) to the server. They will later then be able to download them again. Could I achieve this with the current stack?

我遇到了使用 Multer JS 的教程,该教程的前部指定了"multipart/form-data"结尾.如果使用此功能,我的Express可以在将巨大的单个视频文件写入服务器磁盘时提供其他HTTP请求吗?

I came across tutorials using Multer JS with "multipart/form-data" specified by the front-end. If I use this, would my Express be able to serve up other HTTP requests while writing a giant single video file to the server's disk?

推荐答案

Multer应该可以正常工作.它将通过HTTP将数据流传输到磁盘上的文件中.它不会锁定您的服务器.然后,在您的端点中,您可以访问该文件位置,并可以使用它进行所需的任何操作.

Multer should work fine. It'll stream the data as it comes in over HTTP to a file on disk. It won't lock up your server. Then in your endpoint you have access to that file location and can do whatever you need with it.

这篇关于将大文件上传到NodeJS Web服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆