Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
aws-s3-multipart-copy
Advanced tools
Readme
Wraps aws-sdk with a multipart-copy manager, in order to provide an easy way to copy large objects from one bucket to another in aws-s3. The module manages the copy parts order and bytes range according to the size of the object and the desired copy part size. It speeds up the multipart copying process by sending multiple copy-part requests simultaneously.
** The package supports aws-sdk version '2006-03-01' and above.
** The package supports node 8 version and above.
npm install aws-s3-multipart-copy
aws-s3-multipart-copy is based on the aws-sdk and therefore requires an initialized AWS.S3 instance.
Also, it requires a logger instance which supports 'info' and 'error' level of logging (meaning logger.info and logger.error are functions).
let bunyan = require('bunyan'),
AWS = require('aws-sdk'),
s3Module = require('aws-s3-multipart-copy');
let logger = bunyan.createLogger({
name: 'copy-object-multipart',
level: 'info',
version: 1.0.0,
logType: 'copy-object-multipart-log',
serializers: { err: bunyan.stdSerializers.err }
});
let s3 = new AWS.S3();
s3Module.init(s3, logger);
After module is initialized, the copyObjectMultipart functionality is ready for usage. copyObjectMultipart returns a promise and can only copy (and not upload) objects from bucket to bucket.
** Objects size for multipart copy must be at least 5MB.
The method receives two parameters: options and request_context
A successful result might hold any of the following keys as specified in aws s3 completeMultipartUpload docs
In case multipart copy fails, three scenarios are possible:
Positive
let request_context = 'request_context';
let options = {
source_bucket: 'source_bucket',
object_key: 'object_key',
destination_bucket: 'destination_bucket',
copied_object_name: 'someLogicFolder/copied_object_name',
object_size: 70000000,
copy_part_size_bytes: 50000000,
copied_object_permissions: 'bucket-owner-full-control',
expiration_period: 100000,
storage_class: 'STANDARD'
};
return s3Module.copyObjectMultipart(options, request_context)
.then((result) => {
console.log(result);
})
.catch((err) => {
// handle error
})
/* Response:
result = {
Bucket: "acexamplebucket",
ETag: "\"4d9031c7644d8081c2829f4ea23c55f7-2\"",
Expiration: 100000,
Key: "bigobject",
Location: "https://examplebucket.s3.amazonaws.com/bigobject"
}
*/
Negative 1 - abort action passed but copy parts were not removed
let request_context = 'request_context';
let options = {
source_bucket: 'source_bucket',
object_key: 'object_key',
destination_bucket: 'destination_bucket',
copied_object_name: 'someLogicFolder/copied_object_name',
object_size: 70000000,
copy_part_size_bytes: 50000000,
copied_object_permissions: 'bucket-owner-full-control',
expiration_period: 100000,
storage_class: 'STANDARD'
};
return s3Module.copyObjectMultipart(options, request_context)
.then((result) => {
// handle result
})
.catch((err) => {
console.log(err);
})
/*
err = {
message: 'Abort procedure passed but copy parts were not removed'
details: {
Parts: ['part 1', 'part 2']
}
}
*/
Negative 2 - abort action succeded
let request_context = 'request_context';
let options = {
source_bucket: 'source_bucket',
object_key: 'object_key',
destination_bucket: 'destination_bucket',
copied_object_name: 'someLogicFolder/copied_object_name',
object_size: 70000000,
copy_part_size_bytes: 50000000,
copied_object_permissions: 'bucket-owner-full-control',
expiration_period: 100000,
storage_class: 'STANDARD'
};
return s3Module.copyObjectMultipart(options, request_context)
.then((result) => {
// handle result
})
.catch((err) => {
console.log(err);
})
/*
err = {
message: 'multipart copy aborted',
details: {
Bucket: destination_bucket,
Key: copied_object_name,
UploadId: upload_id
}
}
*/
FAQs
This node js package provides a simple usage for multipart copying between buckets in aws-s3 via the official aws-sdk. It manages the 3 steps required for multipart copy including byte-range offsetting and parts order.
The npm package aws-s3-multipart-copy receives a total of 1,400 weekly downloads. As such, aws-s3-multipart-copy popularity was classified as popular.
We found that aws-s3-multipart-copy demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.