Package Exports
- etag-stream
- etag-stream/esm/index.js
- etag-stream/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (etag-stream) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ETag Stream
A Transform stream that calculates Etag/S3 MD5 sum. Uses the same algorithm that S3 uses to calculate the ETag.
This is especially useful for verifying large files uploaded using multipart S3 API, enabling use of createReadStream to keep memory usage low.
Installation
npm install etag-streamUsage
const ETagStream = require('etag-stream');
const stream = new ETagStream();
let result = null;
stream
.on('error', e => {
reject(e);
})
.on('etag', data => {
result = data.toString();
})
.on('data', data => {
// data passes through if you need to do more!
})
.on('finish', () => {
resolve(result);
});
createReadStream(local).pipe(stream);ETags compatible with s3, thanks to the author of this post for the breakdown of the algorithm.