Skip to content

Commit a9535f3

Browse files
committed
Merge branch 'master' into develop
2 parents 6cbdc0b + 7a40fda commit a9535f3

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

libs/core/Converter.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,16 @@ function emitDone(conv) {
8686
};
8787
}
8888
}
89-
var useBufferFrom=process.versions.node.split(".")[0]>=6;
90-
function bufFromString(str){
91-
return useBufferFrom?Buffer.from(str,"utf8"):new Buffer(str,"utf8");
89+
90+
91+
function bufFromString(str) {
92+
var buffer = Buffer.allocUnsafe
93+
? Buffer.allocUnsafe(str.length)
94+
: new Buffer(str.length);
95+
buffer.write(str);
96+
return buffer;
9297
}
98+
9399
Converter.prototype._transform = function (data, encoding, cb) {
94100
data=this.prepareData(data);
95101
var idx =data.length-1;

0 commit comments

Comments
 (0)