Skip to content

hashFileOid

Hashes the content of the provided file as an object of the provided type, and returns an Oid corresponding to the result. This does not store the object inside any object database or repository.

Signature

ts
function hashFileOid(objType: ObjectType, path: string): string;

Parameters

  • objTyperequired · ObjectType

    Git object type.

    - Any : Any kind of git object
    - Commit : An object which corresponds to a git commit
    - Tree : An object which corresponds to a git tree
    - Blob : An object which corresponds to a git blob
    - Tag : An object which corresponds to a git tag

  • pathrequired · string

    File path to make hash.

Returns

  • string

    Hashed string.

Released under the MIT License.