-
HI everyone. I am implementing the feature to upload the file to the s3 buucket. |
Beta Was this translation helpful? Give feedback.
Answered by
RanVaknin
May 25, 2023
Replies: 2 comments
-
Hi @lonelytechpot , You can use it like this: const AWS = require("aws-sdk");
const fs = require("fs");
const s3 = new AWS.S3();
const file = fs.readFileSync("/path/to/your/file/helloworld.txt");
const params = {
Bucket: "my-bucket",
Key: "my-key",
Body: file
};
s3.upload(params, function(err, data) {
if (err) {
console.log("Error!", err);
}
if (data) {
console.log("Success!", data.Location);
}
}); You need to supply a correct path to the file you want to read from disk with Let us know if you need anything else, |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
RanVaknin
-
Hello! Reopening this discussion to make it searchable. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @lonelytechpot ,
You can use it like this:
You need to supply a correct path to the file you want to read from disk with
fs
.Let us know if you need anything else,
Ran~