@@ -10,23 +10,23 @@ const HiredisParser = require('../test/hiredis')
1010function returnError ( error ) { }
1111function checkReply ( error , res ) { }
1212
13- const startBuffer = new Buffer ( '$100\r\nabcdefghij' )
14- const chunkBuffer = new Buffer ( 'abcdefghijabcdefghijabcdefghij' )
15- const stringBuffer = new Buffer ( '+testing a simple string\r\n' )
16- const integerBuffer = new Buffer ( ':1237884\r\n' )
17- const bigIntegerBuffer = new Buffer ( ':184467440737095516171234567890\r\n' ) // 2^64 + 1
18- const errorBuffer = new Buffer ( '-Error ohnoesitbroke\r\n' )
19- const endBuffer = new Buffer ( '\r\n' )
13+ const startBuffer = Buffer . from ( '$100\r\nabcdefghij' )
14+ const chunkBuffer = Buffer . from ( 'abcdefghijabcdefghijabcdefghij' )
15+ const stringBuffer = Buffer . from ( '+testing a simple string\r\n' )
16+ const integerBuffer = Buffer . from ( ':1237884\r\n' )
17+ const bigIntegerBuffer = Buffer . from ( ':184467440737095516171234567890\r\n' ) // 2^64 + 1
18+ const errorBuffer = Buffer . from ( '-Error ohnoesitbroke\r\n' )
19+ const endBuffer = Buffer . from ( '\r\n' )
2020const lorem = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, ' +
2121 'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. ' +
2222 'Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ' +
2323 'ut aliquip ex ea commodo consequat. Duis aute irure dolor in' // 256 chars
2424const bigStringArray = ( new Array ( Math . pow ( 2 , 16 ) / lorem . length ) . join ( lorem + ' ' ) ) . split ( ' ' ) // Math.pow(2, 16) chars long
25- const startBigBuffer = new Buffer ( '$' + ( 4 * 1024 * 1024 ) + '\r\n' )
25+ const startBigBuffer = Buffer . from ( '$' + ( 4 * 1024 * 1024 ) + '\r\n' )
2626
2727const chunks = new Array ( 64 )
2828for ( var i = 0 ; i < 64 ; i ++ ) {
29- chunks [ i ] = new Buffer ( bigStringArray . join ( ' ' ) + '.' ) // Math.pow(2, 16) chars long
29+ chunks [ i ] = Buffer . from ( bigStringArray . join ( ' ' ) + '.' ) // Math.pow(2, 16) chars long
3030}
3131
3232const arraySize = 100
@@ -38,24 +38,24 @@ for (i = 0; i < arraySize; i++) {
3838 array += size + '\r\n' + lorem . slice ( 0 , size ) + '\r\n'
3939}
4040
41- const arrayBuffer = new Buffer ( array )
41+ const arrayBuffer = Buffer . from ( array )
4242
4343const bigArraySize = 160
44- const bigArrayChunks = [ new Buffer ( '*1\r\n*1\r\n*' + bigArraySize ) ]
44+ const bigArrayChunks = [ Buffer . from ( '*1\r\n*1\r\n*' + bigArraySize ) ]
4545for ( i = 0 ; i < bigArraySize ; i ++ ) {
4646 // A chunk has a maximum size of 2^16 bytes.
4747 size = 65000 + i
4848 if ( i % 2 ) {
4949 // The "x" in the beginning is important to prevent benchmark manipulation due to a minor jsparser optimization
50- bigArrayChunks . push ( new Buffer ( 'x\r\n$' + size + '\r\n' + Array ( size + 1 ) . join ( 'a' ) + '\r\n:' + ( Math . random ( ) * 1000000 | 0 ) ) )
50+ bigArrayChunks . push ( Buffer . from ( 'x\r\n$' + size + '\r\n' + Array ( size + 1 ) . join ( 'a' ) + '\r\n:' + ( Math . random ( ) * 1000000 | 0 ) ) )
5151 } else {
52- bigArrayChunks . push ( new Buffer ( '\r\n+this is some short text about nothing\r\n:' + size + '\r\n$' + size + '\r\n' + Array ( size ) . join ( 'b' ) ) )
52+ bigArrayChunks . push ( Buffer . from ( '\r\n+this is some short text about nothing\r\n:' + size + '\r\n$' + size + '\r\n' + Array ( size ) . join ( 'b' ) ) )
5353 }
5454}
55- bigArrayChunks . push ( new Buffer ( '\r\n' ) )
55+ bigArrayChunks . push ( Buffer . from ( '\r\n' ) )
5656
57- const chunkedStringPart1 = new Buffer ( '+foobar' )
58- const chunkedStringPart2 = new Buffer ( 'bazEND\r\n' )
57+ const chunkedStringPart1 = Buffer . from ( '+foobar' )
58+ const chunkedStringPart2 = Buffer . from ( 'bazEND\r\n' )
5959
6060const options = {
6161 returnReply : checkReply ,
0 commit comments