SHA-256 cryptographic hash function implementation for TypeScript and JavaScript
91
A command-line utility that computes SHA-256 checksums for files of any size using streaming to handle large files efficiently.
The utility must read and process files incrementally in chunks rather than loading entire files into memory at once. This ensures that even very large files (multiple gigabytes) can be processed with minimal memory usage.
The utility must be able to compute checksums for multiple files in a single run, processing each file independently.
@generates
/**
* Computes the SHA-256 hash of a file by reading it in chunks.
*
* @param filePath - Path to the file to hash
* @param chunkSize - Size of chunks to read (in bytes), defaults to 64KB
* @returns Promise that resolves to the hex-encoded hash string
*/
export async function hashFile(filePath: string, chunkSize?: number): Promise<string>;
/**
* Computes SHA-256 hashes for multiple files.
*
* @param filePaths - Array of file paths to hash
* @param chunkSize - Size of chunks to read (in bytes), defaults to 64KB
* @returns Promise that resolves to a map of file paths to their hex-encoded hashes
*/
export async function hashFiles(filePaths: string[], chunkSize?: number): Promise<Map<string, string>>;Provides SHA-256 cryptographic hash functionality with support for incremental hashing.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/npm-stablelib--sha256docs
evals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10