@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
[v8.1.1] 2021-04-30 -- Patch Release
Please note changes in 8.1.1 may not yet be released in future versions, as this
is a backport/patch release on the 8.x series of releases. Updates that are
included in the future will have a corresponding CHANGELOG entry in future releases.
Added
- CUMULUS-2497
- Created
isISOFile()
to check if a CMR file is a CMR ISO file.
Fixed
- CUMULUS-2512
- Updated ingest package S3 provider client to take additional parameter
remoteAltBucket
on download
method to allow for per-file override of
provider bucket for checksum - Updated @cumulus/ingest.fetchTextFile's signature to be parameterized and
added
remoteAltBucket
to allow for an override of the passed in provider
bucket for the source file - Update "eslint-plugin-import" to be pinned to 2.22.1
Changed
-
CUMULUS-2497
- Changed the
@cumulus/cmrjs
package:
- Updated
@cumulus/cmrjs/cmr-utils.getGranuleTemporalInfo()
so it now
returns temporal info for CMR ISO 19115 SMAP XML files. - Updated
@cumulus/cmrjs/cmr-utils.isCmrFilename()
to include
isISOFile()
.
-
2216
- Removed "node-forge", "xml-crypto" from audit whitelist, added "underscore"