Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/package-deps-hash > hashFilesAsync

hashFilesAsync() function

This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

Uses git hash-object to hash the provided files. Unlike getGitHashForFiles, this API is asynchronous, and also allows for the input file paths to be specified as an async iterable.

Signature:

export declare function hashFilesAsync(rootDirectory: string, filesToHash: Iterable<string> | AsyncIterable<string>, gitPath?: string): Promise<Iterable<[string, string]>>;

Parameters

Parameter

Type

Description

rootDirectory

string

The root directory to which paths are specified relative. Must be the root of the Git repository.

filesToHash

Iterable<string> | AsyncIterable<string>

The file paths to hash using git hash-object

gitPath

string

(Optional) The path to the Git executable

Returns:

Promise<Iterable<[string, string]>>

An iterable of [filePath, hash] pairs

Remarks

The input file paths must be specified relative to the Git repository root, or else be absolute paths.