Files
pnpm/crypto/integrity
Zoltan Kochan 1701a65845 chore: reduce noisy warnings in test output (#11022)
* chore: reduce noisy warnings in test output

- Suppress ExperimentalWarning and DEP0169 via --disable-warning in NODE_OPTIONS
- Fix MaxListenersExceededWarning by raising limit in StoreIndex when adding exit listeners
- Update meta-updater to generate the new _test scripts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: stop streaming pnpm subprocess output during CLI tests

Buffer stdout/stderr from execPnpm instead of writing to the parent
process in real time. Output is still included in the error message on
failure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: pipe all subprocess output in CLI tests

Use stdio: 'pipe' for all pnpm/pnpx spawn helpers so subprocess output
is buffered instead of printed. Output is still included in error
messages on failure.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: remove duplicate @pnpm/installing.env-installer in pnpm/package.json

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* chore: use pipe stdio in dlx and errorHandler tests

Replace stdio: 'inherit' and [null, 'pipe', 'inherit'] with 'pipe' to
prevent subprocess output from leaking into test output.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: skip maxListeners adjustment when set to unlimited (0)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 10:43:12 +01:00
..

@pnpm/crypto.integrity

Parse and format integrity strings

Utilities for working with single-hash integrity strings in the format algorithm-base64hash (e.g., sha512-abc123...). This is the format used in pnpm lockfiles.

Installation

pnpm add @pnpm/crypto.integrity

Usage

import { parseIntegrity } from '@pnpm/crypto.integrity'

const { algorithm, hexDigest } = parseIntegrity('sha512-9/u6bgY2+JDlb7vzKD5STG+jIErimDgtYkdB0NxmODJuKCxBvl5CVNiCB3LFUYosWowMf37aGVlKfrU5RT4e1w==')

console.log(algorithm)  // 'sha512'
console.log(hexDigest)  // 'f7fbba6e0636f890e56fbbf3283e524c6fa3204ae298382d624741d0dc6638326e282c41be5e4254d8820772c5518a2c5a8c0c7f7eda19594a7eb539453e1ed7'

API

parseIntegrity(integrity: string): ParsedIntegrity

Parses an integrity string and returns the algorithm and hex-encoded digest.

Throws PnpmError with code INVALID_INTEGRITY if:

  • The format is invalid (must be algorithm-base64hash)
  • The base64 hash decodes to an empty digest

formatIntegrity(algorithm: string, hexDigest: string): string

Formats a hex digest into an integrity string.

import { formatIntegrity } from '@pnpm/crypto.integrity'

const integrity = formatIntegrity('sha512', 'f7fbba6e...')
// 'sha512-9/u6bgY2+JDlb7vzKD5STG+...'

License

MIT