---
layout: default
menu_item: api
title: Blame
description: Version 0.26.1
menu_item: api
return_to:
"API Documentation Index": /api/
sections:
"file": "#file"
"#buffer": "#buffer"
"#getHunkByIndex": "#getHunkByIndex"
"#getHunkByLine": "#getHunkByLine"
"#getHunkCount": "#getHunkCount"
"FLAG": "#FLAG"
---
## Blame.file Async
```js
Blame.file(repo, path, [options]).then(function(blame) {
// Use blame
});
```
Retrieve the blame of a file
| Parameters | Type | |
| --- | --- | --- |
| repo | [Repository](/api/repository/) | that contains the file |
| path | String | to the file to get the blame of |
| [options] | [BlameOptions](/api/blame_options/) | Options for the blame |
| Returns | |
| --- | --- |
| [Blame](/api/blame/) | the blame |
## Blame#buffer Async
```js
blame.buffer(buffer, buffer_len).then(function(blame) {
// Use blame
});
```
| Parameters | Type |
| --- | --- | --- |
| buffer | String | the (possibly) modified contents of the file |
| buffer_len | Number | number of valid bytes in the buffer |
| Returns | |
| --- | --- |
| [Blame](/api/blame/) | |
## Blame#getHunkByIndex Sync
```js
var blameHunk = blame.getHunkByIndex(index);
```
| Parameters | Type |
| --- | --- | --- |
| index | Number | index of the hunk to retrieve |
| Returns | |
| --- | --- |
| [BlameHunk](/api/blame_hunk/) | the hunk at the given index, or NULL on error |
## Blame#getHunkByLine Sync
```js
var blameHunk = blame.getHunkByLine(lineno);
```
| Parameters | Type |
| --- | --- | --- |
| lineno | Number | the (1-based) line number to find a hunk for |
| Returns | |
| --- | --- |
| [BlameHunk](/api/blame_hunk/) | the hunk that contains the given line, or NULL on error |
## Blame#getHunkCount Sync
```js
var result = blame.getHunkCount();
```
| Returns | |
| --- | --- |
| Number | |
## Blame.FLAG ENUM
| Flag | Value |
| --- | --- | --- |
| Blame.FLAG.NORMAL | 0 |
| Blame.FLAG.TRACK_COPIES_SAME_FILE | 1 |
| Blame.FLAG.TRACK_COPIES_SAME_COMMIT_MOVES | 2 |
| Blame.FLAG.TRACK_COPIES_SAME_COMMIT_COPIES | 4 |
| Blame.FLAG.TRACK_COPIES_ANY_COMMIT_COPIES | 8 |
| Blame.FLAG.FIRST_PARENT | 16 |
| Blame.FLAG.USE_MAILMAP | 32 |