简体   繁体   English

从离子/角度前端将json直接发布到Amazon s3存储桶

[英]post json directly to amazon s3 bucket from ionic/angular front end

I am struggling to figure out how, or if possible, I can post/put data into an aws s3 bucket from an angular/ionic application... 我正在努力寻找如何或如果可能的话,将数据从角度/离子应用程序发布/放入AWS S3存储桶中的方法...

I have a mobile application that has two surveys, one for before using the product, second for after using the product... after both surveys I want to just dumb the data in an aws bucket. 我有一个移动应用程序,它有两个调查,一个用于使用产品之前,第二个用于使用产品之后……在两次调查之后,我只想将数据愚弄到aws存储桶中。 The amount of data is pretty small... about 50 surveys are expected each with basic text answers to ~20ish questions. 数据量非常小...预计大约有50个调查,每个调查都有约20个问题的基本文本答案。

Does anyone have any idea how I can do this in ionic/angular or any front end? 有谁知道如何在离子/角度或任何前端进行此操作? Do I need to convert it to a file somehow and then post that? 我需要以某种方式将其转换为文件然后发布吗?

Any help is appreciated 任何帮助表示赞赏

You can upload a JSON object directly to a bucket in s3. 您可以将JSON对象直接上传到s3中的存储桶。 You don't have to upload it through a file, although I have no idea how to do it in Ionic/Angular, here is sample of how it is done in Node. 尽管我不知道如何在Ionic / Angular中进行操作,但您不必通过文件上传它,但是这里是在Node中如何进行操作的示例。

s3.putObject({Bucket: 'bucket_name',Key: 'my_products.json',Body: JSON.stringify(products), ContentType: "application/json"},function(err, data){console.log(JSON.stringify(err)+" "+JSON.stringify(data));});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM