• Home
  • Raw
  • Download

Lines Matching refs:from

32 const d = Buffer.from([]);
46 const e = Buffer.from(ui32);
71 Buffer.from('');
72 Buffer.from('', 'ascii');
73 Buffer.from('', 'latin1');
111 const writeTest = Buffer.from('abcdes');
230 const d = Buffer.from([23, 42, 255]);
235 assert.deepStrictEqual(d, Buffer.from(d));
240 const e = Buffer.from('über');
241 assert.deepStrictEqual(e, Buffer.from([195, 188, 98, 101, 114]));
246 const f = Buffer.from('über', 'ascii');
247 assert.deepStrictEqual(f, Buffer.from([252, 98, 101, 114]));
253 const f = Buffer.from('über', encoding);
254 assert.deepStrictEqual(f, Buffer.from([252, 0, 98, 0, 101, 0, 114, 0]));
259 const f = Buffer.from('привет', encoding);
261 f, Buffer.from([63, 4, 64, 4, 56, 4, 50, 4, 53, 4, 66, 4])
267 const f = Buffer.from([0, 0, 0, 0, 0]);
271 assert.deepStrictEqual(f, Buffer.from([0x42, 0x30, 0x44, 0x30, 0x00]));
276 const f = Buffer.from('\uD83D\uDC4D', 'utf-16le'); // THUMBS UP SIGN (U+1F44D)
278 assert.deepStrictEqual(f, Buffer.from('3DD84DDC', 'hex'));
284 let g = Buffer.from(arrayIsh);
285 assert.deepStrictEqual(g, Buffer.from([0, 1, 2, 3]));
287 g = Buffer.from(strArrayIsh);
288 assert.deepStrictEqual(g, Buffer.from([0, 1, 2, 3]));
294 assert.strictEqual((Buffer.from('Man')).toString('base64'), 'TWFu');
295 assert.strictEqual((Buffer.from('Woman')).toString('base64'), 'V29tYW4=');
300 assert.strictEqual((Buffer.from('Man')).toString('base64url'), 'TWFu');
301 assert.strictEqual((Buffer.from('Woman')).toString('base64url'), 'V29tYW4');
306 assert.deepStrictEqual(Buffer.from('//++/++/++//', 'base64'),
307 Buffer.from(expected));
308 assert.deepStrictEqual(Buffer.from('__--_--_--__', 'base64'),
309 Buffer.from(expected));
310 assert.deepStrictEqual(Buffer.from('//++/++/++//', 'base64url'),
311 Buffer.from(expected));
312 assert.deepStrictEqual(Buffer.from('__--_--_--__', 'base64url'),
313 Buffer.from(expected));
321 assert.deepStrictEqual(Buffer.from('//++/++/++//+w==', 'base64'),
322 Buffer.from(expected));
323 assert.deepStrictEqual(Buffer.from('//++/++/++//+w==', 'base64'),
324 Buffer.from(expected));
325 assert.deepStrictEqual(Buffer.from('//++/++/++//+w==', 'base64url'),
326 Buffer.from(expected));
327 assert.deepStrictEqual(Buffer.from('//++/++/++//+w==', 'base64url'),
328 Buffer.from(expected));
345 assert.strictEqual(Buffer.from(quote).toString('base64'), expected);
347 Buffer.from(quote).toString('base64url'),
371 b = Buffer.from(expectedWhite, encoding);
382 b = Buffer.from(expectedIllegal, encoding);
389 assert.strictEqual(Buffer.from('', encoding).toString(), '');
390 assert.strictEqual(Buffer.from('K', encoding).toString(), '');
393 assert.strictEqual(Buffer.from('Kg==', encoding).toString(), '*');
394 assert.strictEqual(Buffer.from('Kio=', encoding).toString(), '*'.repeat(2));
395 assert.strictEqual(Buffer.from('Kioq', encoding).toString(), '*'.repeat(3));
397 Buffer.from('KioqKg==', encoding).toString(), '*'.repeat(4));
399 Buffer.from('KioqKio=', encoding).toString(), '*'.repeat(5));
401 Buffer.from('KioqKioq', encoding).toString(), '*'.repeat(6));
402 assert.strictEqual(Buffer.from('KioqKioqKg==', encoding).toString(),
404 assert.strictEqual(Buffer.from('KioqKioqKio=', encoding).toString(),
406 assert.strictEqual(Buffer.from('KioqKioqKioq', encoding).toString(),
408 assert.strictEqual(Buffer.from('KioqKioqKioqKg==', encoding).toString(),
410 assert.strictEqual(Buffer.from('KioqKioqKioqKio=', encoding).toString(),
412 assert.strictEqual(Buffer.from('KioqKioqKioqKioq', encoding).toString(),
414 assert.strictEqual(Buffer.from('KioqKioqKioqKioqKg==', encoding).toString(),
416 assert.strictEqual(Buffer.from('KioqKioqKioqKioqKio=', encoding).toString(),
418 assert.strictEqual(Buffer.from('KioqKioqKioqKioqKioq', encoding).toString(),
421 Buffer.from('KioqKioqKioqKioqKioqKg==', encoding).toString(),
424 Buffer.from('KioqKioqKioqKioqKioqKio=', encoding).toString(),
427 Buffer.from('KioqKioqKioqKioqKioqKioq', encoding).toString(),
429 assert.strictEqual(Buffer.from('KioqKioqKioqKioqKioqKioqKg==',
432 assert.strictEqual(Buffer.from('KioqKioqKioqKioqKioqKioqKio=',
437 assert.strictEqual(Buffer.from('Kg', encoding).toString(), '*');
438 assert.strictEqual(Buffer.from('Kio', encoding).toString(), '*'.repeat(2));
439 assert.strictEqual(Buffer.from('KioqKg', encoding).toString(), '*'.repeat(4));
441 Buffer.from('KioqKio', encoding).toString(), '*'.repeat(5));
442 assert.strictEqual(Buffer.from('KioqKioqKg', encoding).toString(),
444 assert.strictEqual(Buffer.from('KioqKioqKio', encoding).toString(),
446 assert.strictEqual(Buffer.from('KioqKioqKioqKg', encoding).toString(),
448 assert.strictEqual(Buffer.from('KioqKioqKioqKio', encoding).toString(),
450 assert.strictEqual(Buffer.from('KioqKioqKioqKioqKg', encoding).toString(),
452 assert.strictEqual(Buffer.from('KioqKioqKioqKioqKio', encoding).toString(),
454 assert.strictEqual(Buffer.from('KioqKioqKioqKioqKioqKg', encoding).toString(),
457 Buffer.from('KioqKioqKioqKioqKioqKio', encoding).toString(),
460 Buffer.from('KioqKioqKioqKioqKioqKioqKg', encoding).toString(),
463 Buffer.from('KioqKioqKioqKioqKioqKioqKio', encoding).toString(),
469 Buffer.from('72INjkR5fchcxk9+VgdGPFJDxUBFR5/rMFsghgxADiw==', 'base64').length,
473 Buffer.from('72INjkR5fchcxk9-VgdGPFJDxUBFR5_rMFsghgxADiw==', 'base64url')
478 Buffer.from('72INjkR5fchcxk9+VgdGPFJDxUBFR5/rMFsghgxADiw=', 'base64').length,
482 Buffer.from('72INjkR5fchcxk9-VgdGPFJDxUBFR5_rMFsghgxADiw=', 'base64url')
487 Buffer.from('72INjkR5fchcxk9+VgdGPFJDxUBFR5/rMFsghgxADiw', 'base64').length,
491 Buffer.from('72INjkR5fchcxk9-VgdGPFJDxUBFR5_rMFsghgxADiw', 'base64url')
496 Buffer.from('w69jACy6BgZmaFvv96HG6MYksWytuZu3T1FvGnulPg==', 'base64').length,
500 Buffer.from('w69jACy6BgZmaFvv96HG6MYksWytuZu3T1FvGnulPg==', 'base64url')
505 Buffer.from('w69jACy6BgZmaFvv96HG6MYksWytuZu3T1FvGnulPg=', 'base64').length,
509 Buffer.from('w69jACy6BgZmaFvv96HG6MYksWytuZu3T1FvGnulPg=', 'base64url')
514 Buffer.from('w69jACy6BgZmaFvv96HG6MYksWytuZu3T1FvGnulPg', 'base64').length,
518 Buffer.from('w69jACy6BgZmaFvv96HG6MYksWytuZu3T1FvGnulPg', 'base64url').length,
524 const dot = Buffer.from('//4uAA==', 'base64');
534 const dot = Buffer.from('//4uAA', 'base64url');
573 assert.strictEqual(Buffer.from('=bad'.repeat(1e4), 'base64').length, 0);
576 assert.deepStrictEqual(Buffer.from('w0 ', 'base64'),
577 Buffer.from('w0', 'base64'));
580 assert.deepStrictEqual(Buffer.from(' YWJvcnVtLg', 'base64'),
581 Buffer.from('YWJvcnVtLg', 'base64'));
587 const b = Buffer.from(s);
623 const hexb2 = Buffer.from(hexStr, 'hex');
630 assert.strictEqual(Buffer.from('A', 'hex').length, 0);
633 assert.deepStrictEqual(Buffer.from('Abx', 'hex'), Buffer.from('Ab', 'hex'));
636 assert.strictEqual(Buffer.from('A', 'base64').length, 0);
641 const b = Buffer.from([1, 2, 3, 4, 5]);
716 const b = Buffer.from([0xde, 0xad, 0xbe, 0xef]);
733 const b = Buffer.from([0xde, 0xad, 0xbe, 0xef]);
751 let buf = Buffer.from('\0');
753 buf = Buffer.from('\0\0');
829 const buf = Buffer.from('ab\ud800cd', 'utf8');
841 const buf = Buffer.from([0, 0, 0, 0, 0]); // length: 5
868 assert.strictEqual(Buffer.from({ length: 3.3 }).length, 3);
869 assert.strictEqual(Buffer.from({ length: 'BAM' }).length, 0);
872 assert.strictEqual(Buffer.from('99').length, 2);
873 assert.strictEqual(Buffer.from('13.37').length, 5);
883 const b = Buffer.from('xxx');
889 Buffer.from(Buffer.allocUnsafe(0), 0, 0);
1017 () => Buffer.from('', 'buffer'),
1030 const b = Buffer.from(a);
1031 const c = Buffer.from(b);
1045 const b1 = Buffer.from('YW55=======', 'base64');
1046 const b2 = Buffer.from('YW55', 'base64');
1070 assert.throws(() => Buffer.from(), {
1075 assert.throws(() => Buffer.from(null), {
1092 assert.deepStrictEqual(Buffer.from({ length: -Buffer.poolSize }),
1093 Buffer.from(''));
1094 assert.deepStrictEqual(Buffer.from({ length: -100 }),
1095 Buffer.from(''));
1098 Buffer.from('abc');
1109 assert.throws(() => Buffer.from(new ArrayBuffer(0), -1 >>> 0), errMsg);
1128 Buffer.from(new ArrayBuffer());
1132 Buffer.from(arrayBuf);
1133 Buffer.from({ buffer: arrayBuf });
1142 const buf = Buffer.from('test');