-
Notifications
You must be signed in to change notification settings - Fork 698
Expand file tree
/
Copy pathbuf.js
More file actions
43 lines (36 loc) · 1.01 KB
/
buf.js
File metadata and controls
43 lines (36 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
var util = require("util");
var NodeGit = require("../");
var Buf = NodeGit.Buf;
var _set = Buf.prototype.set;
var _grow = Buf.prototype.grow;
var _isBinary = Buf.prototype.isBinary;
var _containsNul = Buf.prototype.containsNul;
/**
* Sets the content of a GitBuf to a string.
* @param {string} The utf8 value to set in the buffer.
* The string will be null terminated.
*/
var _setString = function(content) {
const buf = Buffer.from(content + "\0", "utf8");
this.set(buf, buf.length);
};
Buf.prototype.set = util.deprecate(
_set,
"NodeGit.Buf.prototype.set is deprecated."
);
Buf.prototype.setString = util.deprecate(
_setString,
"NodeGit.Buf.prototype.setString is deprecated."
);
Buf.prototype.grow = util.deprecate(
_grow,
"NodeGit.Buf.prototype.grow is deprecated."
);
Buf.prototype.isBinary = util.deprecate(
_isBinary,
"NodeGit.Buf.prototype.isBinary is deprecated."
);
Buf.prototype.containsNul = util.deprecate(
_containsNul,
"NodeGit.Buf.prototype.containsNul is deprecated."
);