22layout : default
33menu_item : api
44title : Blob
5- description : Version 0.26.0
5+ description : Version 0.26.1
66menu_item : api
77return_to :
88 " API Documentation Index " : /api/
@@ -16,12 +16,14 @@ sections:
1616 " #content " : " #content"
1717 " #dup " : " #dup"
1818 " #filemode " : " #filemode"
19+ " #filter " : " #filter"
1920 " #id " : " #id"
2021 " #isBinary " : " #isBinary"
2122 " #owner " : " #owner"
2223 " #rawcontent " : " #rawcontent"
2324 " #rawsize " : " #rawsize"
2425 " #toString " : " #toString"
26+ " FILTER_FLAG " : " #FILTER_FLAG"
2527---
2628
2729## <a name =" createFromBuffer " ></a ><span >Blob.</span >createFromBuffer <span class =" tags " ><span class =" async " >Async</span ></span >
@@ -86,13 +88,13 @@ Blob.filteredContent(blob, as_path, check_for_binary_data).then(function(buffer)
8688
8789| Parameters | Type | |
8890| --- | --- | --- |
89- | blob | [ Blob] ( /api/blob/ ) | Pointer to the blob |
90- | as_path | String | Path used for file attribute lookups, etc. |
91- | check_for_binary_data | Number | Should this test if blob content contains NUL bytes / looks like binary data before applying filters? |
91+ | blob | [ Blob] ( /api/blob/ ) | |
92+ | as_path | String | |
93+ | check_for_binary_data | Number | |
9294
9395| Returns | |
9496| --- | --- |
95- | Buffer | The git_buf to be filled in |
97+ | Buffer | |
9698
9799## <a name =" lookup " ></a ><span >Blob.</span >lookup <span class =" tags " ><span class =" async " >Async</span ></span >
98100
@@ -167,6 +169,30 @@ Retrieve the Blob's type.
167169| --- | --- |
168170| Number | The filemode of the blob. |
169171
172+ ## <a name =" filter " ></a ><span >Blob#</span >filter <span class =" tags " ><span class =" async " >Async</span ></span >
173+
174+ ``` js
175+ blob .filter (asPath, opts).then (function (promiseString ) {
176+ // Use promiseString
177+ });
178+ ```
179+
180+ Get a buffer with the filtered content of a blob.
181+
182+ This applies filters as if the blob was being checked out to the
183+ working directory under the specified filename. This may apply
184+ CRLF filtering or other types of changes depending on the file
185+ attributes set for the blob and the content detected in it.
186+
187+ | Parameters | Type |
188+ | --- | --- | --- |
189+ | asPath | | Path used for file attribute lookups, etc. |
190+ | opts | | Options to use for filtering the blob |
191+
192+ | Returns | |
193+ | --- | --- |
194+ | Promise.<string > | |
195+
170196## <a name =" id " ></a ><span >Blob#</span >id <span class =" tags " ><span class =" sync " >Sync</span ></span >
171197
172198``` js
@@ -230,3 +256,11 @@ Retrieve the Blob's content as String.
230256| --- | --- |
231257| String | Contents as a string. |
232258
259+ ## <a name =" FILTER_FLAG " ></a ><span >Blob.</span >FILTER_FLAG <span class =" tags " ><span class =" enum " >ENUM</span ></span >
260+
261+ | Flag | Value |
262+ | --- | --- | --- |
263+ | <span >Blob.FILTER_FLAG.</span >CHECK_FOR_BINARY | 1 |
264+ | <span >Blob.FILTER_FLAG.</span >NO_SYSTEM_ATTRIBUTES | 2 |
265+ | <span >Blob.FILTER_FLAG.</span >ATTTRIBUTES_FROM_HEAD | 4 |
266+
0 commit comments