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