Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@cumulus/checksum

Package Overview
Dependencies
Maintainers
12
Versions
148
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cumulus/checksum - npm Package Compare versions

Comparing version 10.0.0-beta.0 to 10.0.0

1

dist/checksum.d.ts
/// <reference types="node" />
import { Readable, TransformOptions } from 'stream';
export declare function normalizeHashAlgorithm(algorithm: string): string;
/**

@@ -4,0 +5,0 @@ * Create <algorithm> file checksum from readable stream

@@ -22,5 +22,22 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.generateChecksumFromStream = void 0;
exports.generateChecksumFromStream = exports.normalizeHashAlgorithm = void 0;
const cksum = __importStar(require("cksum"));
const crypto = __importStar(require("crypto"));
function normalizeHashAlgorithm(algorithm) {
switch (algorithm) {
case 'SHA-1':
return 'SHA1';
case 'SHA-2':
return 'SHA2';
case 'SHA-256':
return 'SHA256';
case 'SHA-384':
return 'SHA384';
case 'SHA-512':
return 'SHA512';
default:
return algorithm;
}
}
exports.normalizeHashAlgorithm = normalizeHashAlgorithm;
// Calculate the cksum of a readable stream

@@ -34,4 +51,5 @@ async function getCksumFromStream(stream) {

async function getChecksumFromStream(algorithm, stream, options = {}) {
const normalizedAlgorithm = normalizeHashAlgorithm(algorithm);
return await new Promise((resolve, reject) => {
const hash = crypto.createHash(algorithm, options);
const hash = crypto.createHash(normalizedAlgorithm, options);
stream.on('error', reject);

@@ -38,0 +56,0 @@ stream.on('data', (chunk) => hash.update(chunk));

4

package.json
{
"name": "@cumulus/checksum",
"version": "10.0.0-beta.0",
"version": "10.0.0",
"description": "Cumulus checksum utilities",

@@ -42,3 +42,3 @@ "engines": {

},
"gitHead": "bc283986be627ba06a4084cabd4e01d1540d14c7"
"gitHead": "7c6d2d1cd79b57d6943bbc3d898d0cf975b543b1"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc