@cumulus/checksum
Checksum
The @cumulus/checksum
library provides checksum functionality used by Cumulus
packages and tasks. Currently the supported input includes file streams, and
supported checksum algorithms include cksum
and the algorithms available to
the crypto
package, as documented
here.
Usage
const fs = require('fs');
const { generateChecksumFromStream } = require('@cumulus/checksum');
const stream = fs.createReadStream('myDataFile.hdf');
const myCksum = generateChecksumFromStream('cksum', stream);
API
checksum
checksum.generateChecksumFromStream(algorithm, stream, [options]) ⇒ Promise.<(number|string)>
Create file checksum from readable stream
Kind: static method of checksum
Returns: Promise.<(number|string)>
- the file checksum
Param | Type | Description |
---|
algorithm | string | Checksum algorithm type |
stream | stream.Readable | A readable file stream |
[options] | Object | Checksum options, see crypto.createHash() |
checksum.validateChecksumFromStream(algorithm, stream, expectedSum, [options]) ⇒ Promise.<boolean>
Validate expected checksum against calculated checksum
Kind: static method of checksum
Returns: Promise.<boolean>
- whether expectedSum === calculatedSum
Param | Type | Description |
---|
algorithm | string | Checksum algorithm |
stream | stream.Readable | A readable file stream |
expectedSum | number | string | expected checksum |
[options] | Object | Checksum options |
About Cumulus
Cumulus is a cloud-based data ingest, archive, distribution and management
prototype for NASA's future Earth science data streams.
Cumulus Documentation
Generated automatically using npm run build-docs
[v9.4.1] 2022-02-14 [BACKPORT]
Please note changes in 9.4.1 may not yet be released in future versions, as
this is a backport and patch release on the 9.4.x series of releases. Updates that
are included in the future will have a corresponding CHANGELOG entry in future
releases.
- CUMULUS-2847
- Update dynamo configuration to read from S3 instead of System Manager
Parameter Store
- Move api configuration initialization outside the lambda handler to
eliminate unneded S3 calls/require config on cold-start only
- Moved
ssh2
package from @cumulus/common
to @cumulus/sftp-client
and
upgraded package from ^0.8.7
to ^1.0.0
to address security vulnerability
issue in previous version. - Fixed hyrax task package.json dev dependency
- Update CNM lambda dependencies for Core tasks
- cumulus-cnm-response-task: 1.4.4
- cumulus-cnm-to-granule: 1.5.4
- Whitelist ssh2 re: https://github.com/advisories/GHSA-652h-xwhf-q4h6