Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  6] [ 3]  / answers: 1 / hits: 28693  / 7 Years ago, tue, march 21, 2017, 12:00:00

I am new to amazon s3 and am trying to use node.js to upload JSON into a file. My object is users, and it has a bunch of keys and values in it. Here is how I'm uploading it:



 s3.putObject({Bucket: 'currenteventstest',Key: 'users.json',Body: users, ContentType: application/json});


However, when I re download it, it's just an empty object.


More From » json

 Answers
3

Adding a callback function fixes the problem:



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

[#58473] Friday, March 17, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
patienceannel

Total Points: 674
Total Questions: 101
Total Answers: 101

Location: Northern Mariana Islands
Member since Fri, Jan 15, 2021
3 Years ago
patienceannel questions
Fri, Mar 11, 22, 00:00, 2 Years ago
Tue, Oct 20, 20, 00:00, 4 Years ago
Wed, Jul 24, 19, 00:00, 5 Years ago
;