Lines Matching defs:const
2 const common = require('../common');
4 const assert = require('assert');
5 const vm = require('vm');
7 const SlowBuffer = require('buffer').SlowBuffer;
16 const b = Buffer.allocUnsafe(1024);
30 const c = Buffer.allocUnsafe(512);
33 const d = Buffer.from([]);
38 const b = Buffer.alloc(128);
46 const ui8 = new Uint8Array(4).fill(42);
47 const e = Buffer.from(ui8);
48 for (const [index, value] of e.entries()) {
54 const ui8 = new Uint8Array(4).fill(42);
55 const e = Buffer(ui8);
56 for (const [key, value] of e.entries()) {
64 const ui32 = new Uint32Array(4).fill(42);
65 const e = Buffer.from(ui32);
66 for (const [index, value] of e.entries()) {
73 const ui32 = new Uint32Array(4).fill(42);
74 const e = Buffer(ui32);
75 for (const [key, value] of e.entries()) {
102 const outOfRangeError = {
131 const writeTest = Buffer.from('abcdes');
150 const asciiString = 'hello world';
155 const asciiSlice = b.toString('ascii', 0, asciiString.length);
160 const asciiString = 'hello world';
161 const offset = 100;
164 const asciiSlice = b.toString('ascii', offset, offset + asciiString.length);
169 const asciiString = 'hello world';
170 const offset = 100;
172 const sliceA = b.slice(offset, offset + asciiString.length);
173 const sliceB = b.slice(offset, offset + asciiString.length);
181 const utf8String = '¡hέlló wôrld!';
182 const offset = 100;
194 const sliceA = b.slice(offset, offset + Buffer.byteLength(utf8String));
195 const sliceB = b.slice(offset, offset + Buffer.byteLength(utf8String));
202 const slice = b.slice(100, 150);
211 const b = Buffer.allocUnsafe(5);
212 const c = b.slice(0, 4);
213 const d = c.slice(0, 2);
220 const b = Buffer.allocUnsafeSlow(5);
221 const c = b.slice(0, 4);
222 const d = c.slice(0, 2);
228 const testValue = '\u00F6\u65E5\u672C\u8A9E'; // ö日本語
229 const buffer = Buffer.allocUnsafe(32);
230 const size = buffer.write(testValue, 0, 'utf8');
231 const slice = buffer.toString('utf8', 0, size);
237 const a = Buffer.allocUnsafe(8);
239 const b = a.slice(4, 8);
244 const c = b.slice(2, 4);
250 const d = Buffer.from([23, 42, 255]);
260 const e = Buffer.from('über');
266 const f = Buffer.from('über', 'ascii');
273 const f = Buffer.from('über', encoding);
279 const f = Buffer.from('привет', encoding);
287 const f = Buffer.from([0, 0, 0, 0, 0]);
289 const size = f.write('あいうえお', encoding);
296 const f = Buffer.from('\uD83D\uDC4D', 'utf-16le'); // THUMBS UP SIGN (U+1F44D)
303 const arrayIsh = { 0: 0, 1: 1, 2: 2, 3: 3, length: 4 };
306 const strArrayIsh = { 0: '0', 1: '1', 2: '2', 3: '3', length: 4 };
325 const expected = [0xff, 0xff, 0xbe, 0xff, 0xef, 0xbf, 0xfb, 0xef, 0xff];
336 const base64flavors = ['base64', 'base64url'];
340 const expected = [0xff, 0xff, 0xbe, 0xff, 0xef, 0xbf, 0xfb, 0xef, 0xff, 0xfb];
353 const quote = 'Man is distinguished, not only by his reason, but by this ' +
358 const expected = 'TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb' +
378 const expectedWhite = `${expected.slice(0, 60)} \n` +
396 const expectedIllegal = expected.slice(0, 60) + ' \x80' +
544 const dot = Buffer.from('//4uAA==', 'base64');
554 const dot = Buffer.from('//4uAA', 'base64url');
566 const segments = ['TWFkbmVzcz8h', 'IFRoaXM=', 'IGlz', 'IG5vZGUuanMh'];
567 const b = Buffer.allocUnsafe(64);
581 const segments = ['TWFkbmVzcz8h', 'IFRoaXM', 'IGlz', 'IG5vZGUuanMh'];
582 const b = Buffer.allocUnsafe(64);
605 const l = Buffer.poolSize + 5;
606 const s = 'h'.repeat(l);
607 const b = Buffer.from(s);
613 const sb = b.toString();
620 const hexb = Buffer.allocUnsafe(256);
624 const hexStr = hexb.toString('hex');
643 const hexb2 = Buffer.from(hexStr, 'hex');
661 const b = Buffer.from([1, 2, 3, 4, 5]);
662 const b2 = b.toString('hex', 1, 10000);
663 const b3 = b.toString('hex', 1, 5);
664 const b4 = b.toString('hex', 1);
671 const buffer = Buffer.allocUnsafe(data.length);
678 const x = buildBuffer([0x81, 0xa3, 0x66, 0x6f, 0x6f, 0xa3, 0x62, 0x61, 0x72]);
683 const z = x.slice(4);
693 const z = x.slice(0);
698 const z = x.slice(0, 4);
705 const z = x.slice(0, 9);
710 const z = x.slice(1, 4);
716 const z = x.slice(2, 4);
723 const b = Buffer.allocUnsafe(10);
729 const b = Buffer.allocUnsafe(11);
736 const b = Buffer.from([0xde, 0xad, 0xbe, 0xef]);
753 const b = Buffer.from([0xde, 0xad, 0xbe, 0xef]);
778 const buf = Buffer.allocUnsafe(2);
788 const buf = Buffer.allocUnsafe(10);
796 const buf = Buffer.allocUnsafe(4);
837 const b = Buffer.allocUnsafe(16);
849 const buf = Buffer.from('ab\ud800cd', 'utf8');
861 const buf = Buffer.from([0, 0, 0, 0, 0]); // length: 5
862 const sub = buf.slice(0, 4); // length: 4
871 const buf = Buffer.alloc(5, '800A', 'hex');
902 const a = Buffer.allocUnsafe(3);
903 const b = Buffer.from('xxx');
1049 const a = [...Array(128).keys()]; // [0, 1, 2, 3, ... 126, 127]
1050 const b = Buffer.from(a);
1051 const c = Buffer.from(b);
1063 const crypto = require('crypto');
1065 const b1 = Buffer.from('YW55=======', 'base64');
1066 const b2 = Buffer.from('YW55', 'base64');
1076 const ps = Buffer.poolSize;
1124 const errMsg = common.expectsError({
1134 const a = Buffer.alloc(1);
1135 const b = Buffer.alloc(1);
1141 const ubuf = Buffer.allocUnsafeSlow(10);
1151 const arrayBuf = vm.runInNewContext('new ArrayBuffer()');
1162 const buf = Buffer.from('test');