In some cases, using this library's operations might impact performance and skew your test results.Performance considerations and recommended practices
To ensure accurate results, consider executing these operations in the setup and teardown lifecycle functions. These functions run before and after the test run and have no impact on the test results.
S3Client interacts with the AWS Simple Storage Service (S3).
With it, you can do several operations such as list buckets, list objects in a bucket, or download objects from a bucket. For a full list of supported operations, see Methods.
Both the dedicated s3.js jslib bundle and the all-encompassing aws.js bundle include the S3Client.
Methods
Function | Description |
---|---|
listBuckets() | List the buckets the authenticated user has access to |
listObjects(bucketName, [prefix]) | List the objects contained in a bucket |
getObject(bucketName, objectKey) | Download an object from a bucket |
putObject(bucketName, objectKey, data) | Upload an object to a bucket |
deleteObject(bucketName, objectKey) | Delete an object from a bucket |
copyObject(sourceBucket, sourceKey, destinationBucket, destinationKey) | Copy an object from one bucket to another |
createMultipartUpload(bucketName, objectKey) | Create a multipart upload for a given objectKey to a bucket |
uploadPart(bucketName, objectKey, uploadId, partNumber, data) | Upload a part in a multipart upload |
completeMultipartUpload(bucketName, objectKey, uploadId, parts) | Complete a previously assembled multipart upload |
abortMultipartUpload(bucketName, objectKey, uploadId) | Abort a multipart upload |
Throws
S3 Client methods will throw errors in case of failure.
Error | Condition |
---|---|
InvalidSignatureError | when invalid credentials were provided. |
S3ServiceError | when AWS replied to the requested operation with an error. |