anthi:_anti_hair_thinning_hair_spray.png
this the file name in s3 when it downloaded using s3 client it save file with name anthi and with 0kb also file type shows file , wherever in s3 it is 100kb and file type is png
I am using fs to save the file locally with same name please help me
const objects = await s3.listObjectsV2(listParams).promise();
for (const object of objects.Contents) {
if (object.Size >= MIN_FILE_SIZE_IN_BYTES) {
const fileKey = object.Key;
const fileExtension = path.extname(fileKey).toLowerCase();
if (allowedFileExtensions.includes(fileExtension)) {
const localFilePath = path.join(localDownloadFolder, path.basename(fileKey));
const data = await s3.getObject({ Bucket: bucketName, Key: fileKey }).promise();
fs.writeFileSync(localFilePath, data.Body);
// console.log(`File downloaded to: ${localFilePath}`);
}
}
}
I will be very thankful for any suggestion or advice.
i tried to download files form asw s3 bucket
it is failing to download file name (anthi:_anti_hair_thinning_hair_spray.png ) with column
as using fs to write file in folder
how could i fix this?