https://github.com/pyramation/etag-stream
A Transform stream that calculates Etag/S3 MD5 sum. Uses the same algorithm as S3.
https://github.com/pyramation/etag-stream
es6 etag javascript node-module npm s3 streams
Last synced: about 1 month ago
JSON representation
A Transform stream that calculates Etag/S3 MD5 sum. Uses the same algorithm as S3.
- Host: GitHub
- URL: https://github.com/pyramation/etag-stream
- Owner: pyramation
- License: mit
- Created: 2018-10-14T03:36:30.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-10-01T00:25:06.000Z (over 5 years ago)
- Last Synced: 2025-03-13T02:03:51.469Z (about 1 year ago)
- Topics: es6, etag, javascript, node-module, npm, s3, streams
- Language: JavaScript
- Size: 6.72 MB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
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
```sh
npm install etag-stream
```
## Usage
```js
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](https://stackoverflow.com/questions/12186993/what-is-the-algorithm-to-compute-the-amazon-s3-etag-for-a-file-larger-than-5gb#answer-19896823) for the breakdown of the algorithm.