how to upload images to digital ocean spaces code example
Example: how to upload images to digital ocean spaces
const AWS = require('aws-sdk')
const spacesEndpoint = new AWS.Endpoint('nyc3.digitaloceanspaces.com');
const s3 = new AWS.S3({
endpoint: spacesEndpoint,
accessKeyId: 'ACCESS_KEY',
secretAccessKey: 'SECRET_KEY'
});
var params = {
Body: "The contents of the file",
Bucket: "my-new-space-with-a-unique-name",
Key: "file.ext",
};
s3.putObject(params, function(err, data) {
if (err) console.log(err, err.stack);
else console.log(data);
});