@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
[v13.3.2] 2022-10-10 [BACKPORT]
Please note changes in 13.3.2 may not yet be released in future versions, as
this is a backport and patch release on the 13.3.x series of releases. Updates that
are included in the future will have a corresponding CHANGELOG entry in future
releases.
Fixed
- CUMULUS-2557
- Updated
@cumulus/aws-client/S3/moveObject
to handle zero byte files (0 byte files).
- CUMULUS-2971
- Updated
@cumulus/aws-client/S3ObjectStore
class to take string query parameters and
its methods signGetObject
and signHeadObject
to take parameter presignOptions
- CUMULUS-3021
- Updated
@cumulus/api-client/collections
and @cumulus/integration-tests/api
to encode
collection version in the URI path
- CUMULUS-3024
- Update PUT /granules endpoint to operate consistently across datastores
(PostgreSQL, ElasticSearch, DynamoDB). Previously it was possible, given a
partial Granule payload to have different data in Dynamo/ElasticSearch and PostgreSQL
- Given a partial Granule object, the /granules update endpoint now operates
with behavior more consistent with a PATCH operation where fields not provided
in the payload will not be updated in the datastores.
- Granule translation (db/src/granules.ts) now supports removing null/undefined fields when converting from API to Postgres
granule formats.
- Update granule write logic: if a
null
files key is provided in an update payload (e.g. files: null
),
an error will be thrown. null
files were not previously supported and would throw potentially unclear errors. This makes the error clearer and more explicit. - Update granule write logic: If an empty array is provided for the
files
key, all files will be removed in all datastores