Comparing version 1.10.2 to 1.11.0
@@ -59,3 +59,3 @@ /* jshint node: true */ | ||
// First 4 bytes of an Avro object container file. | ||
var MAGIC_BYTES = new Buffer('Obj\x01'); | ||
var MAGIC_BYTES = Buffer.from('Obj\x01'); | ||
@@ -95,3 +95,3 @@ // Convenience. | ||
this._type = parse(schema); | ||
this._tap = new Tap(new Buffer(0)); | ||
this._tap = new Tap(Buffer.alloc(0)); | ||
this._needPush = false; | ||
@@ -150,4 +150,4 @@ this._readValue = createReader(decode, this._type); | ||
this._parseOpts = opts.parseOpts || {}; | ||
this._tap = new Tap(new Buffer(0)); | ||
this._blockTap = new Tap(new Buffer(0)); | ||
this._tap = new Tap(Buffer.alloc(0)); | ||
this._blockTap = new Tap(Buffer.alloc(0)); | ||
this._syncMarker = null; | ||
@@ -227,3 +227,3 @@ this._readValue = null; | ||
this._write = this._writeChunk; | ||
this._write(new Buffer(0), encoding, cb); | ||
this._write(Buffer.alloc(0), encoding, cb); | ||
}; | ||
@@ -307,3 +307,3 @@ | ||
}; | ||
this._tap = new Tap(new Buffer(opts.batchSize || 65536)); | ||
this._tap = new Tap(Buffer.alloc(opts.batchSize || 65536)); | ||
} | ||
@@ -326,3 +326,3 @@ util.inherits(RawEncoder, stream.Transform); | ||
// Not enough space for last written object, need to resize. | ||
tap.buf = new Buffer(2 * len); | ||
tap.buf = Buffer.alloc(2 * len); | ||
} | ||
@@ -389,3 +389,3 @@ tap.pos = 0; | ||
this._blockSize = opts.blockSize || 65536; | ||
this._tap = new Tap(new Buffer(this._blockSize)); | ||
this._tap = new Tap(Buffer.alloc(this._blockSize)); | ||
this._codecs = opts.codecs; | ||
@@ -433,4 +433,4 @@ this._codec = opts.codec || 'null'; | ||
var meta = { | ||
'avro.schema': new Buffer(this._schema || this._type.getSchema()), | ||
'avro.codec': new Buffer(this._codec) | ||
'avro.schema': Buffer.from(this._schema || this._type.getSchema()), | ||
'avro.codec': Buffer.from(this._codec) | ||
}; | ||
@@ -460,3 +460,3 @@ var Header = HEADER_TYPE.getRecordConstructor(); | ||
} | ||
tap.buf = new Buffer(this._blockSize); | ||
tap.buf = Buffer.alloc(this._blockSize); | ||
tap.pos = 0; | ||
@@ -526,3 +526,3 @@ this._writeValue(tap, val); // Rewrite last failed write. | ||
var fd = fs.openSync(path, 'r'); | ||
var buf = new Buffer(size); | ||
var buf = Buffer.alloc(size); | ||
var pos = 0; | ||
@@ -556,3 +556,3 @@ var tap = new Tap(buf); | ||
var len = 2 * tap.buf.length; | ||
var buf = new Buffer(len); | ||
var buf = Buffer.alloc(len); | ||
len = fs.readSync(fd, buf, 0, len); | ||
@@ -641,3 +641,3 @@ tap.buf = Buffer.concat([tap.buf, buf]); | ||
function copyBuffer(buf, pos, len) { | ||
var copy = new Buffer(len); | ||
var copy = Buffer.alloc(len); | ||
buf.copy(copy, 0, pos, pos + len); | ||
@@ -644,0 +644,0 @@ return copy; |
@@ -313,3 +313,3 @@ /* jshint node: true */ | ||
noPtcl ? null : {string: this._ptcl.toString()}, | ||
new Buffer(hashString, 'binary') | ||
Buffer.from(hashString, 'binary') | ||
); | ||
@@ -417,3 +417,3 @@ }; | ||
function emit(retry) { | ||
var tap = new Tap(new Buffer(self._bufferSize)); | ||
var tap = new Tap(Buffer.alloc(self._bufferSize)); | ||
@@ -624,3 +624,3 @@ var handshakeReq = self._createHandshakeRequest(serverHashString, !retry); | ||
var tap = new Tap(new Buffer(this._bufferSize)); | ||
var tap = new Tap(Buffer.alloc(this._bufferSize)); | ||
var id = this._id++; | ||
@@ -746,3 +746,3 @@ try { | ||
serverMatch ? null : {'org.apache.avro.ipc.MD5': getHash(this._ptcl)}, | ||
validationErr ? {map: {error: new Buffer(validationErr.message)}} : null | ||
validationErr ? {map: {error: Buffer.from(validationErr.message)}} : null | ||
); | ||
@@ -814,3 +814,3 @@ | ||
this._tap = new Tap(new Buffer(this._bufferSize)); | ||
this._tap = new Tap(Buffer.alloc(this._bufferSize)); | ||
this._message = undefined; | ||
@@ -900,3 +900,3 @@ | ||
var reqTap = new Tap(buf); | ||
var resTap = new Tap(new Buffer(self._bufferSize)); | ||
var resTap = new Tap(Buffer.alloc(self._bufferSize)); | ||
if (self._validateHandshake(reqTap, resTap)) { | ||
@@ -912,3 +912,3 @@ self._decoder | ||
var reqTap = new Tap(buf); | ||
var resTap = new Tap(new Buffer(self._bufferSize)); | ||
var resTap = new Tap(Buffer.alloc(self._bufferSize)); | ||
var id = 0; | ||
@@ -1059,3 +1059,3 @@ try { | ||
stream.Transform.call(this); | ||
this._buf = new Buffer(0); | ||
this._buf = Buffer.alloc(0); | ||
this._bufs = []; | ||
@@ -1110,2 +1110,4 @@ this._length = 0; | ||
this.emit('error', new Error('no message decoded')); | ||
} else { | ||
this.emit('finish'); | ||
} | ||
@@ -1148,3 +1150,3 @@ }; | ||
function intBuffer(n) { | ||
var buf = new Buffer(4); | ||
var buf = Buffer.alloc(4); | ||
buf.writeInt32BE(n); | ||
@@ -1167,3 +1169,3 @@ return buf; | ||
if (!tap.isValid()) { | ||
var buf = new Buffer(tap.pos); | ||
var buf = Buffer.alloc(tap.pos); | ||
tap.buf.copy(buf, 0, 0, pos); | ||
@@ -1227,3 +1229,3 @@ tap.buf = buf; | ||
function getHash(ptcl) { | ||
return new Buffer(ptcl._hashString, 'binary'); | ||
return Buffer.from(ptcl._hashString, 'binary'); | ||
} | ||
@@ -1230,0 +1232,0 @@ |
@@ -59,3 +59,3 @@ /* jshint node: true */ | ||
// Encoding tap (shared for performance). | ||
var TAP = new Tap(new buffer.SlowBuffer(1024)); | ||
var TAP = new Tap(Buffer.allocUnsafeSlow(1024)); | ||
@@ -170,3 +170,3 @@ // Path prefix for validity checks (shared for performance). | ||
Type.__reset = function (size) { TAP.buf = new buffer.SlowBuffer(size); }; | ||
Type.__reset = function (size) { TAP.buf = Buffer.allocUnsafeSlow(size); }; | ||
@@ -266,3 +266,3 @@ Type.prototype.createResolver = function (type, opts) { | ||
} | ||
var buf = new Buffer(TAP.pos); | ||
var buf = Buffer.alloc(TAP.pos); | ||
TAP.buf.copy(buf, 0, 0, TAP.pos); | ||
@@ -658,3 +658,3 @@ return buf; | ||
} | ||
buf = new Buffer(obj, 'binary'); | ||
buf = Buffer.from(obj, 'binary'); | ||
this._check(buf, throwInvalidError); | ||
@@ -666,3 +666,3 @@ return buf; | ||
} | ||
buf = new Buffer(obj.data); | ||
buf = Buffer.from(obj.data); | ||
this._check(buf, throwInvalidError); | ||
@@ -672,3 +672,3 @@ return buf; | ||
this._check(obj, throwInvalidError); | ||
return new Buffer(obj); | ||
return Buffer.from(obj); | ||
} | ||
@@ -675,0 +675,0 @@ }; |
@@ -201,3 +201,3 @@ /* jshint node: true */ | ||
} | ||
return new Buffer(arr); | ||
return Buffer.from(arr); | ||
}; | ||
@@ -427,3 +427,3 @@ | ||
} | ||
var fixed = new Buffer(len); | ||
var fixed = Buffer.alloc(len); | ||
this.buf.copy(fixed, 0, pos, pos + len); | ||
@@ -551,3 +551,3 @@ return fixed; | ||
Tap.prototype.unpackLongBytes = function () { | ||
var res = new Buffer(8); | ||
var res = Buffer.alloc(8); | ||
var n = 0; | ||
@@ -554,0 +554,0 @@ var i = 0; // Byte index in target buffer. |
{ | ||
"name": "avro-js", | ||
"version": "1.10.2", | ||
"version": "1.11.0", | ||
"author": "Avro Developers <dev@avro.apache.org>", | ||
@@ -5,0 +5,0 @@ "description": "JavaScript Avro implementation", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
168545
4888