This might help everyone. I just solved the issue when uploaded file to space, by default is set to private. This is how you can change it to public. Full code, btw this is node:
const
s3 = require('s3'),
GV = require('/path/to/config/file');
let client = s3.createClient({
s3Options: {
accessKeyId: GV.digitalOcean.spaces.key,
secretAccessKey: GV.digitalOcean.spaces.secret,
region: GV.digitalOcean.spaces.region,
endpoint: GV.digitalOcean.spaces.endpoint
},
});
let
params = {
localDir: '/local/path/file',
deleteRemoved: true,
s3Params: {
Bucket: GV.digitalOcean.spaces.bucketName,
Prefix: '/remote/path/file',
ACL: 'public-read' // this should set the file to Public
},
},
uploader = client.uploadDir(params);
uploader.on('error', function(err) {
console.error("unable to sync:", err.stack);
});
uploader.on('progress', function() {
console.log("progress", uploader.progressAmount, uploader.progressTotal);
});
uploader.on('end', function() {
console.log('done');
});