--- layout: default menu_item: api title: Buf description: Version 0.26.1 menu_item: api return_to: "API Documentation Index": /api/ sections: "#containsNul": "#containsNul" "#dispose": "#dispose" "#grow": "#grow" "#isBinary": "#isBinary" "#set": "#set" "#setString": "#setString" "Instance Variables": "#ivars" --- ## Buf#containsNul SyncExperimental ```js var result = buf.containsNul(); ``` | Returns | | | --- | --- | | Number | 1 if buffer contains a NUL byte | ## Buf#dispose SyncExperimental ```js buf.dispose(); ``` ## Buf#grow SyncExperimental ```js var result = buf.grow(target_size); ``` | Parameters | Type | | --- | --- | --- | | target_size | Number | The desired available size | | Returns | | | --- | --- | | Number | 0 on success, -1 on allocation failure | ## Buf#isBinary SyncExperimental ```js var result = buf.isBinary(); ``` | Returns | | | --- | --- | | Number | 1 if buffer looks like non-text data | ## Buf#set SyncExperimental ```js var result = buf.set(data, datalen); ``` | Parameters | Type | | --- | --- | --- | | data | Buffer | The data to copy into the buffer | | datalen | Number | The length of the data to copy into the buffer | | Returns | | | --- | --- | | Number | 0 on success, -1 on allocation failure | ## Buf#setString Sync ```js buf.setString(The); ``` Sets the content of a GitBuf to a string. | Parameters | Type | | --- | --- | --- | | The | string | utf8 value to set in the buffer. The string will be null terminated. | ## Instance Variables | Variable | Type | Description | | --- | --- | --- | | asize | Number | | | ptr | String | | | size | Number | |