File tree Expand file tree Collapse file tree 4 files changed +17
-17
lines changed
Expand file tree Collapse file tree 4 files changed +17
-17
lines changed Original file line number Diff line number Diff line change @@ -202,7 +202,7 @@ function OutBatch() {
202202
203203OutBatch . prototype . append = function ( buf , flags , cb ) {
204204 if ( ! Buffer . isBuffer ( buf ) ) {
205- buf = new Buffer ( String ( buf ) , 'utf8' ) ;
205+ buf = Buffer . from ( String ( buf ) , 'utf8' ) ;
206206 }
207207
208208 this . content . push ( buf , flags ) ;
@@ -409,7 +409,7 @@ Object.keys(opts).forEach(function(name){
409409 } ) ;
410410
411411 Socket . prototype . __defineSetter__ ( name , function ( val ) {
412- if ( 'string' == typeof val ) val = new Buffer ( val , 'utf8' ) ;
412+ if ( 'string' == typeof val ) val = Buffer . from ( val , 'utf8' ) ;
413413 return this . _zmq . setsockopt ( opts [ name ] , val ) ;
414414 } ) ;
415415} ) ;
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ describe('socket.messages', function(){
3636 push . connect ( 'inproc://stuff_ssm' ) ;
3737 push . send ( 'string' ) ;
3838 push . send ( 15.99 ) ;
39- push . send ( new Buffer ( 'buffer' ) ) ;
39+ push . send ( Buffer . from ( 'buffer' ) ) ;
4040 } ) ;
4141 } ) ;
4242
@@ -53,7 +53,7 @@ describe('socket.messages', function(){
5353 pull . bind ( 'inproc://stuff_ssmm' , function ( error ) {
5454 if ( error ) throw error ;
5555 push . connect ( 'inproc://stuff_ssmm' ) ;
56- push . send ( [ 'string' , 15.99 , new Buffer ( 'buffer' ) ] ) ;
56+ push . send ( [ 'string' , 15.99 , Buffer . from ( 'buffer' ) ] ) ;
5757 } ) ;
5858 } ) ;
5959
@@ -111,7 +111,7 @@ describe('socket.messages', function(){
111111 if ( error ) throw error ;
112112 push . send ( 'string' ) ;
113113 push . send ( 15.99 ) ;
114- push . send ( new Buffer ( 'buffer' ) ) ;
114+ push . send ( Buffer . from ( 'buffer' ) ) ;
115115 pull . connect ( 'tcp://127.0.0.1:12345' ) ;
116116 } ) ;
117117 } ) ;
Original file line number Diff line number Diff line change @@ -35,10 +35,10 @@ describe('socket.zap', function(){
3535 return ;
3636 }
3737
38- var serverPublicKey = new Buffer ( '7f188e5244b02bf497b86de417515cf4d4053ce4eb977aee91a55354655ec33a' , 'hex' )
39- , serverPrivateKey = new Buffer ( '1f5d3873472f95e11f4723d858aaf0919ab1fb402cb3097742c606e61dd0d7d8' , 'hex' )
40- , clientPublicKey = new Buffer ( 'ea1cc8bd7c8af65497d43fc21dbec6560c5e7b61bcfdcbd2b0dfacf0b4c38d45' , 'hex' )
41- , clientPrivateKey = new Buffer ( '83f99afacfab052406e5f421612568034e85f4c8182a1c92671e83dca669d31d' , 'hex' ) ;
38+ var serverPublicKey = Buffer . from ( '7f188e5244b02bf497b86de417515cf4d4053ce4eb977aee91a55354655ec33a' , 'hex' )
39+ , serverPrivateKey = Buffer . from ( '1f5d3873472f95e11f4723d858aaf0919ab1fb402cb3097742c606e61dd0d7d8' , 'hex' )
40+ , clientPublicKey = Buffer . from ( 'ea1cc8bd7c8af65497d43fc21dbec6560c5e7b61bcfdcbd2b0dfacf0b4c38d45' , 'hex' )
41+ , clientPrivateKey = Buffer . from ( '83f99afacfab052406e5f421612568034e85f4c8182a1c92671e83dca669d31d' , 'hex' ) ;
4242
4343 rep . on ( 'message' , function ( msg ) {
4444 msg . should . be . an . instanceof ( Buffer ) ;
Original file line number Diff line number Diff line change @@ -24,20 +24,20 @@ module.exports.start = function(count) {
2424 var zapReq = {
2525 version : data . shift ( ) ,
2626 requestId : data . shift ( ) ,
27- domain : new Buffer ( data . shift ( ) ) . toString ( 'utf8' ) ,
28- address : new Buffer ( data . shift ( ) ) . toString ( 'utf8' ) ,
29- identity : new Buffer ( data . shift ( ) ) . toString ( 'utf8' ) ,
30- mechanism : new Buffer ( data . shift ( ) ) . toString ( 'utf8' ) ,
27+ domain : Buffer . from ( data . shift ( ) ) . toString ( 'utf8' ) ,
28+ address : Buffer . from ( data . shift ( ) ) . toString ( 'utf8' ) ,
29+ identity : Buffer . from ( data . shift ( ) ) . toString ( 'utf8' ) ,
30+ mechanism : Buffer . from ( data . shift ( ) ) . toString ( 'utf8' ) ,
3131 credentials : data . slice ( 0 )
3232 } ;
3333
3434 zap . send ( returnPath . concat ( [
3535 zapReq . version ,
3636 zapReq . requestId ,
37- new Buffer ( "200" , "utf8" ) ,
38- new Buffer ( "OK" , "utf8" ) ,
39- new Buffer ( 0 ) ,
40- new Buffer ( 0 )
37+ Buffer . from ( "200" , "utf8" ) ,
38+ Buffer . from ( "OK" , "utf8" ) ,
39+ Buffer . alloc ( 0 ) ,
40+ Buffer . alloc ( 0 )
4141 ] ) ) ;
4242 } ) ;
4343
You can’t perform that action at this time.
0 commit comments