Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
aws-s3-multipart-copy
Advanced tools
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.
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.
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.