@@ -8,6 +8,7 @@ return_to:
88 " API Documentation Index " : /api/
99sections :
1010 " blobToBuffer " : " #blobToBuffer"
11+ " fromBuffer " : " #fromBuffer"
1112 " indexToIndex " : " #indexToIndex"
1213 " indexToWorkdir " : " #indexToWorkdir"
1314 " treeToIndex " : " #treeToIndex"
@@ -20,6 +21,7 @@ sections:
2021 " #merge " : " #merge"
2122 " #numDeltas " : " #numDeltas"
2223 " #patches " : " #patches"
24+ " #toBuf " : " #toBuf"
2325 " DELTA " : " #DELTA"
2426 " FIND " : " #FIND"
2527 " FLAG " : " #FLAG"
@@ -51,6 +53,23 @@ Directly run a diff between a blob and a buffer.
5153| hunk_cb | Function | Callback for each hunk in diff; can be NULL |
5254| line_cb | Function | Callback for each line in diff; can be NULL |
5355
56+ ## <a name="fromBuffer"></a><span>Diff.</span>fromBuffer <span class="tags"><span class="async">Async</span></span>
57+
58+ ` ` ` js
59+ Diff .fromBuffer (content, content_len).then (function (diff ) {
60+ // Use diff
61+ });
62+ ` ` `
63+
64+ | Parameters | Type | |
65+ | --- | --- | --- |
66+ | content | String | The contents of a patch file |
67+ | content_len | Number | The length of the patch file contents |
68+
69+ | Returns | |
70+ | --- | --- |
71+ | [Diff](/api/diff/) | |
72+
5473## <a name="indexToIndex"></a><span>Diff.</span>indexToIndex <span class="tags"><span class="async">Async</span></span>
5574
5675` ` ` js
@@ -244,6 +263,23 @@ Retrieve patches in this difflist
244263| --- | --- |
245264| Array<[ConvenientPatch](/api/convenient_patch/)> | a promise that resolves to an array of ConvenientPatches |
246265
266+ ## <a name="toBuf"></a><span>Diff#</span>toBuf <span class="tags"><span class="async">Async</span></span>
267+
268+ ` ` ` js
269+ diff .toBuf (format).then (function (buf ) {
270+ // Use buf
271+ });
272+ ` ` `
273+
274+ | Parameters | Type |
275+ | --- | --- | --- |
276+ | format | Number | A git_diff_format_t value to pick the text format. |
277+
278+ | Returns | |
279+ | --- | --- |
280+ | [Buf](/api/buf/) | a user-allocated git_buf that will
281+ contain the diff text |
282+
247283## <a name="DELTA"></a><span>Diff.</span>DELTA <span class="tags"><span class="enum">ENUM</span></span>
248284
249285| Flag | Value |
0 commit comments