79169098

Date: 2024-11-08 07:11:20
Score: 0.5
Natty:
Report link

how can i retrieve cid from AWS S3 sdk Response Header When Uploading to BTFS-Compatible

this is my code :

 const s3 = new S3Client({
  endpoint: "http://127.0.0.1:6001/",
  credentials: {
    accessKeyId: "82f87bd29-9aa5-492e-b479-2afc7bb73fe6", 
    secretAccessKey: "WGicMAdP6fWE9syQi1mL4utpQI3NZwpqs"
  },
  forcePathStyle: true,
  apiVersion: "v4",
  region: "us-east-1"
});

try {
        const response = await s3.send(new PutObjectCommand(params));
        console.log(await response);
      } catch (caught) {
        if (
          caught instanceof S3ServiceException &&
          caught.name === "EntityTooLarge"
        ) {
          console.error(
            `Error from S3 while uploading object to ${bucketName}. \
    The object was too large. To upload objects larger than 5GB, use the S3 console (160GB max) \
    or the multipart upload API (5TB max).`
          );
        } else if (caught instanceof S3ServiceException) {
          console.error(
            `Error from S3 while uploading object to ${bucketName}.  ${caught.name}: ${caught.message}`
          );
        } else {
          throw caught;
        }
      }

response output

Reasons:
  • Blacklisted phrase (0.5): how can i
  • Long answer (-1):
  • Has code block (-0.5):
  • Starts with a question (0.5): how can i
  • Low reputation (1):
Posted by: Mohammed Saad Abban