Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
knox-mpu-alt
Advanced tools
Provide multi part upload functionality to Amazon S3 using the knox library. Forked from knox-mpu.
A Node.js client designed to make large file uploads to Amazon S3 via the MultiPartUpload API simple and easy. It's built on top of the excellent Knox library from the guys over at LearnBoost.
Planned
Installation is done via NPM, by running npm install knox-mpu
To upload a stream, simply pass the stream when constructing the MultiPartUpload. The upload will then listen to the stream, and create parts from incoming data stream. When a part reaches the minimum part size, it will attempt to upload it to S3.
// Create a Knox client first
var client = knox.createClient({ ... }),
upload = null;
upload = new MultiPartUpload(
{
client: client,
objectName: 'destination.txt', // Amazon S3 object name
stream: stream
},
// Callback handler
function(err, body) {
// If successful, will return body, containing Location, Bucket, Key, ETag and size of the object
/*
{
Location: 'http://Example-Bucket.s3.amazonaws.com/destination.txt',
Bucket: 'Example-Bucket',
Key: 'destination.txt',
ETag: '"3858f62230ac3c915f300c664312c11f-9"',
size: 7242880
}
*/
}
);
To upload a file, pass the path to the file in the constructor. Knox-mpu will split the file into parts and upload them.
// Create a Knox client first
var client = knox.createClient({ ... }),
upload = null;
upload = new MultiPartUpload(
{
client: client,
objectName: 'destination.txt', // Amazon S3 object name
file: ... // path to the file
},
// Callback handler
function(err, body) {
// If successful, will return body, containing Location, Bucket, Key, ETag and size of the object
/*
{
Location: 'http://Example-Bucket.s3.amazonaws.com/destination.txt',
Bucket: 'Example-Bucket',
Key: 'destination.txt',
ETag: '"3858f62230ac3c915f300c664312c11f-9"',
size: 7242880
}
*/
}
);
The following options can be passed to the MultiPartUpload constructor -
client
Required The knox client to use for this upload requestobjectName
Required The destination object name/path on S3 for this uploadstream
The stream to upload (required if file is not being supplied)file
The path to the file (required if stream is not being supplied)headers
Any additional headers to include on the requestspartSize
The minimum size of the parts to upload (default to 5MB).batchSize
The maximum number of concurrent parts that can be uploading at any one time (default is 4)maxUploadSize
The maximum size of the file to upload (default inifinity). Useful if there is a stream with unknown length.noDisk
If true, parts will be kept in-memory instead of written to temp files (default to false).maxRetries
Number of times to retry failed part upload (default is 0 for no retry).The MultiPartUpload will emit a number of events -
initiated
Emitted when the multi part upload has been initiated, and received an upload ID. Passes the upload id through as the first argument to the eventuploading
Emitted each time a part starts uploading. The part id is passed as the first argument.uploaded
Emitted each time a part finishes uploading. Passes through an object containing the part id and Amazon ETag for the uploaded part.error
Emitted each time a part upload fails. Passes an object containing the part id and error messagecompleted
Emitted when the upload has completed successfully. Contains the object information from Amazon S3 (location, bucket, key and ETag)FAQs
Provide multi part upload functionality to Amazon S3 using the knox library. Forked from knox-mpu.
The npm package knox-mpu-alt receives a total of 367 weekly downloads. As such, knox-mpu-alt popularity was classified as not popular.
We found that knox-mpu-alt demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.