@@ -535,17 +535,17 @@ assert.equal('TWFu', (Buffer.from('Man')).toString('base64'));
535
535
{
536
536
// big example
537
537
const quote = 'Man is distinguished, not only by his reason, but by this ' +
538
- 'singular passion from other animals, which is a lust ' +
539
- 'of the mind, that by a perseverance of delight in the ' +
540
- 'continued and indefatigable generation of knowledge, exceeds ' +
541
- ' the short vehemence of any carnal pleasure.';
538
+ 'singular passion from other animals, which is a lust ' +
539
+ 'of the mind, that by a perseverance of delight in the ' +
540
+ 'continued and indefatigable generation of knowledge, ' +
541
+ 'exceeds the short vehemence of any carnal pleasure.';
542
542
const expected = 'TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb' +
543
- '24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBh ' +
544
- 'bmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQgYnk ' +
545
- 'gYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGludWVkIG ' +
546
- 'FuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBle ' +
547
- 'GNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm5hbCBwbGVh ' +
548
- 'c3VyZS4 =';
543
+ '24sIGJ1dCBieSB0aGlzIHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlci ' +
544
+ 'BhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2YgdGhlIG1pbmQsIHRoYXQ ' +
545
+ 'gYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu ' +
546
+ 'dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZ ' +
547
+ 'GdlLCBleGNlZWRzIHRoZSBzaG9ydCB2ZWhlbWVuY2Ugb2YgYW55IGNhcm ' +
548
+ '5hbCBwbGVhc3VyZS4 =';
549
549
assert . equal ( expected , ( Buffer . from ( quote ) ) . toString ( 'base64' ) ) ;
550
550
551
551
let b = Buffer . allocUnsafe ( 1024 ) ;
@@ -555,11 +555,11 @@ assert.equal('TWFu', (Buffer.from('Man')).toString('base64'));
555
555
556
556
// check that the base64 decoder ignores whitespace
557
557
const expectedWhite = expected . slice ( 0 , 60 ) + ' \n' +
558
- expected . slice ( 60 , 120 ) + ' \n' +
559
- expected . slice ( 120 , 180 ) + ' \n' +
560
- expected . slice ( 180 , 240 ) + ' \n' +
561
- expected . slice ( 240 , 300 ) + '\n' +
562
- expected . slice ( 300 , 360 ) + '\n' ;
558
+ expected . slice ( 60 , 120 ) + ' \n' +
559
+ expected . slice ( 120 , 180 ) + ' \n' +
560
+ expected . slice ( 180 , 240 ) + ' \n' +
561
+ expected . slice ( 240 , 300 ) + '\n' +
562
+ expected . slice ( 300 , 360 ) + '\n' ;
563
563
b = Buffer . allocUnsafe ( 1024 ) ;
564
564
bytesWritten = b . write ( expectedWhite , 0 , 'base64' ) ;
565
565
assert . equal ( quote . length , bytesWritten ) ;
@@ -573,11 +573,11 @@ assert.equal('TWFu', (Buffer.from('Man')).toString('base64'));
573
573
574
574
// check that the base64 decoder ignores illegal chars
575
575
const expectedIllegal = expected . slice ( 0 , 60 ) + ' \x80' +
576
- expected . slice ( 60 , 120 ) + ' \xff' +
577
- expected . slice ( 120 , 180 ) + ' \x00' +
578
- expected . slice ( 180 , 240 ) + ' \x98' +
579
- expected . slice ( 240 , 300 ) + '\x03' +
580
- expected . slice ( 300 , 360 ) ;
576
+ expected . slice ( 60 , 120 ) + ' \xff' +
577
+ expected . slice ( 120 , 180 ) + ' \x00' +
578
+ expected . slice ( 180 , 240 ) + ' \x98' +
579
+ expected . slice ( 240 , 300 ) + '\x03' +
580
+ expected . slice ( 300 , 360 ) ;
581
581
b = Buffer . from ( expectedIllegal , 'base64' ) ;
582
582
assert . equal ( quote . length , b . length ) ;
583
583
assert . equal ( quote , b . toString ( 'ascii' , 0 , quote . length ) ) ;
0 commit comments