@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
[v11.1.3] 2022-06-24
Please note changes in 11.1.3 may not yet be released in future versions, as
this is a backport and patch release on the 11.1.x series of releases. Updates that
are included in the future will have a corresponding CHANGELOG entry in future
releases.
Notable changes
- CUMULUS-2929
- Updated
move-granule
task to check the optional collection configuration parameter
meta.granuleMetadataFileExtension
to determine the granule metadata file.
If none is specified, the granule CMR metadata or ISO metadata file is used.
Added
- CUMULUS-2929
- Added optional collection configuration
meta.granuleMetadataFileExtension
to specify CMR metadata
file extension for tasks that utilize metadata file lookups
- CUMULUS-2966
- Added extractPath operation and support of nested string replacement to
url_path
in the collection configuration
Fixed
- CUMULUS-2863
- Fixed
@cumulus/api
validateAndUpdateSqsRule
method to allow 0 retries
and 0 visibilityTimeout in rule's meta.
- CUMULUS-2959
- Fixed
@cumulus/api
granules
module to convert numeric productVolume to string
when an old granule record is retrieved from DynamoDB.
- CUMULUS-2961
- Fixed
data-migration2
granule migration logic to allow for DynamoDb granules that have a null/empty string value for execution
. The migration will now migrate them without a linked execution.