如何将文件从浏览器上传到具有node.js,Express和knox的Amazon S3? [英] How to upload a file from the browser to Amazon S3 with node.js, Express, and knox?

查看:132
本文介绍了如何将文件从浏览器上传到具有node.js,Express和knox的Amazon S3?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找到一些使用node.js,Express和knox的示例代码。

I'm trying to find some example code that utilizes node.js, Express, and knox.

诺克斯的文档只给出了如何上传的明确示例已存储在文件系统中的文件。 https://github.com/learnboost/knox#readme

The docs for Knox only give clear examples of how to upload a file already stored in the file system. https://github.com/learnboost/knox#readme

另外,还有一些简单的教程(即使在Express本身),如何直接上传文件来表达和保存到文件系统。

Additionally, there a number of simple tutorials (even in Express itself) on how to upload files directly to express and save to the file system.

我无法找到的是一个例子,您可以将客户端上传到节点服务器,并将数据直接传输到S3,而不是首先存储在本地文件系统中。

What I'm having trouble finding is an example that lets you upload a client upload to a node server and have the data streamed directly to S3 rather than storing in the local file system first.

有人可以指出一个包含这种信息的要点或其他例子吗?

Can someone point me to a gist or other example that contains this kind of information?

推荐答案

以前的答案涉及上传通过您的node.js服务器,这是低效和不必要的。您的节点服务器不必处理上传的文件的带宽或处理,因为Amazon S3允许从浏览器直接上传

All of the previous answers involve having the upload pass through your node.js server which is inefficient and unnecessary. Your node server does not have to handle the bandwidth or processing of uploaded files whatsoever because Amazon S3 allows uploads direct from the browser.

有一个看这篇博文: http://blog.tcs.de/ post-file-to-s3-using-node /

我还没有尝试过列出的代码,但是看过它,我会尝试执行它,很快,广告将根据我的发现更新这个答案。

I have not tried the code listed there, but having looked over it, it appears solid and I will be attempting an implementation of it shortly ad will update this answer with my findings.

这篇关于如何将文件从浏览器上传到具有node.js,Express和knox的Amazon S3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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