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

查看:35
本文介绍了如何使用 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.

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 本身中)关于如何将文件直接上传到 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天全站免登陆