Fast Buffer safe constructor

v0.7.4-release
Ryan Dahl 2010-09-04 20:58:51 -07:00
parent 565d862f3c
commit 2dda6be799
1 changed files with 4 additions and 0 deletions

View File

@ -91,6 +91,10 @@ function allocPool () {
function Buffer (subject, encoding, legacy, slice_legacy) { function Buffer (subject, encoding, legacy, slice_legacy) {
if (!(this instanceof Buffer)) {
return new Buffer(subject, encoding, legacy, slice_legacy);
}
var length, type; var length, type;
// Are we slicing? // Are we slicing?