How to use the @cumulus/checksum.validateChecksumFromStream function in @cumulus/checksum

To help you get started, we’ve selected a few @cumulus/checksum examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nasa / cumulus / packages / common / aws.js View on Github external
exports.validateS3ObjectChecksum = async ({
  algorithm,
  bucket,
  key,
  expectedSum,
  options
}) => {
  const fileStream = exports.getS3ObjectReadStream(bucket, key);
  if (await validateChecksumFromStream(algorithm, fileStream, expectedSum, options)) {
    return true;
  }
  const msg = `Invalid checksum for S3 object s3://${bucket}/${key} with type ${algorithm} and expected sum ${expectedSum}`;
  throw new errors.InvalidChecksum(msg);
};
github nasa / cumulus / packages / aws-client / s3.js View on Github external
exports.validateS3ObjectChecksum = async ({
  algorithm,
  bucket,
  key,
  expectedSum,
  options
}) => {
  const fileStream = exports.getS3ObjectReadStream(bucket, key);
  if (await validateChecksumFromStream(algorithm, fileStream, expectedSum, options)) {
    return true;
  }
  const msg = `Invalid checksum for S3 object s3://${bucket}/${key} with type ${algorithm} and expected sum ${expectedSum}`;
  throw new InvalidChecksum(msg);
};

@cumulus/checksum

Cumulus checksum utilities

Apache-2.0
Latest version published 12 days ago

Package Health Score

82 / 100
Full package analysis