Skip to content

getAttr

Get the value of a git attribute for a path.

Signature

ts
class Repository {
  getAttr(
    path: string,
    name: string,
    options?: AttrOptions | null | undefined
  ): boolean | string | Buffer | null;

Parameters

  • pathrequired · string

    The path to check for attributes. Relative paths are interpreted relative to the repo root.

  • namerequired · string

    The name of the attribute to look up.

  • optionsnull | AttrOptions

    Options for attribute lookup.

    • checkFileThenIndexboolean

      Check the working directory, then the index.

    • checkIndexOnlyboolean

      Check the index only.

    • checkIndexThenFileboolean

      Check the index, then the working directory.

    • checkNoSystemboolean

      Do not use the system gitattributes file.

Returns

  • null | string | boolean | Buffer<ArrayBufferLike>

    Output of the value of the attribute.

Released under the MIT License.