Skip to content

Commit 99fcf0d

Browse files
committed
Convert new Buffer()
1 parent e2d16d6 commit 99fcf0d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/modem.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,12 @@ Modem.prototype.dial = function(options, callback) {
134134

135135
if (options.authconfig) {
136136
optionsf.headers['X-Registry-Auth'] = options.authconfig.key || options.authconfig.base64 ||
137-
new Buffer(JSON.stringify(options.authconfig)).toString('base64');
137+
Buffer.from(JSON.stringify(options.authconfig)).toString('base64');
138138
}
139139

140140
if (options.registryconfig) {
141141
optionsf.headers['X-Registry-Config'] = options.registryconfig.base64 ||
142-
new Buffer(JSON.stringify(options.registryconfig)).toString('base64');
142+
Buffer.from(JSON.stringify(options.registryconfig)).toString('base64');
143143
}
144144

145145
if (options.file) {
@@ -190,7 +190,7 @@ Modem.prototype.dial = function(options, callback) {
190190
Modem.prototype.buildRequest = function(options, context, data, callback) {
191191
var self = this;
192192
var connectionTimeoutTimer;
193-
193+
194194
var opts = self.protocol === 'ssh' ? Object.assign(options, {
195195
agent: ssh({'host': self.host, 'port': self.port}),
196196
protocol: 'http'
@@ -316,7 +316,7 @@ Modem.prototype.buildPayload = function(err, isStream, statusCodes, openStdin, r
316316
Modem.prototype.demuxStream = function(stream, stdout, stderr) {
317317
var nextDataType = null;
318318
var nextDataLength = null;
319-
var buffer = new Buffer('');
319+
var buffer = Buffer.from('');
320320
function processData(data) {
321321
if (data) {
322322
buffer = Buffer.concat([buffer, data]);
@@ -348,7 +348,7 @@ Modem.prototype.demuxStream = function(stream, stdout, stderr) {
348348

349349
function bufferSlice (end) {
350350
var out = buffer.slice(0, end);
351-
buffer = new Buffer(buffer.slice(end, buffer.length));
351+
buffer = Buffer.from(buffer.slice(end, buffer.length));
352352
return out;
353353
}
354354

0 commit comments

Comments
 (0)