Server IP : 108.163.255.210 / Your IP : 3.137.221.252 Web Server : Apache System : Linux blossom.urlnameserver.com 3.10.0-1160.80.1.el7.x86_64 #1 SMP Tue Nov 8 15:48:59 UTC 2022 x86_64 User : ( 1172) PHP Version : 7.2.34 Disable Function : eval,escapeshellarg,proc_close,proc_get_status,proc_nice,proc_open,symlink,system,pcntl_exec,getrusage,chown,chgp,closelog,openlog,syslog,define_syslog_variables,php_ini_loaded_file,getservbyname,getservbyport,posix_getgid,posix_getgrgid,proc_terminate,pfsockopen,apache_child_terminate,posix_mkfifo,posix_setpgid,posix_setuid,hypot,pg_host,pos,posix_access,posix_getcwd,posix_getservbyname,myshellexec,getpid,posix_getsid,posix_isatty,posix_kill,posix_mknod,posix_setgid,posix_setsid,posix_setuid,posix_times,posix_uname,ps_fill,posix_getpwuid,global,ini_restore,zip_open,zip_read,rar_open,bzopen,bzread,bzwrite,apache_get_modules,apache_get_version,phpversionphpinfo,php_ini_scanned_files,get_current_user,disk_total_space,diskfreespace,leak,imap_list,hypo,filedump,safe_mode,getmygid,apache_getenv,apache_setenv,bzread,bzwrite,bzopen,phpini,higlight_file,dos_conv,get_cwd,er_log,cmd,e_name,vdir,get_dir,only_read,ftok,ftpexec,posix_getpwnam,mysql_list_dbs,disk_free_space,session_save_path,confirm_phpdoc_compiled,zip_entry_rea,php_u,psockopen,crack_opendict,crack_getlastmessage,crack_closedict,crack_check,fpassthru,posix_get_last_error,posix_getlogin,posix_getgroups,posix_strerror,posix_getrlimit,posix_getpgrp,posix_getgrnam,pos,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/unilinki/public_html/indijourneys.com/node_modules/buffer/test/ |
Upload File : |
if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false var B = require('../').Buffer var test = require('tape') test('new buffer from array', function (t) { t.equal( new B([1, 2, 3]).toString(), '\u0001\u0002\u0003' ) t.end() }) test('new buffer from array w/ negatives', function (t) { t.equal( new B([-1, -2, -3]).toString('hex'), 'fffefd' ) t.end() }) test('new buffer from array with mixed signed input', function (t) { t.equal( new B([-255, 255, -128, 128, 512, -512, 511, -511]).toString('hex'), '01ff80800000ff01' ) t.end() }) test('new buffer from string', function (t) { t.equal( new B('hey', 'utf8').toString(), 'hey' ) t.end() }) test('new buffer from buffer', function (t) { var b1 = new B('asdf') var b2 = new B(b1) t.equal(b1.toString('hex'), b2.toString('hex')) t.end() }) test('new buffer from ArrayBuffer', function (t) { if (typeof ArrayBuffer !== 'undefined') { var arraybuffer = new Uint8Array([0, 1, 2, 3]).buffer var b = new B(arraybuffer) t.equal(b.length, 4) t.equal(b[0], 0) t.equal(b[1], 1) t.equal(b[2], 2) t.equal(b[3], 3) t.equal(b[4], undefined) } t.end() }) test('new buffer from ArrayBuffer, shares memory', function (t) { if (Buffer.TYPED_ARRAY_SUPPORT) { var u = new Uint8Array([0, 1, 2, 3]) var arraybuffer = u.buffer var b = new B(arraybuffer) t.equal(b.length, 4) t.equal(b[0], 0) t.equal(b[1], 1) t.equal(b[2], 2) t.equal(b[3], 3) t.equal(b[4], undefined) // changing the Uint8Array (and thus the ArrayBuffer), changes the Buffer u[0] = 10 t.equal(b[0], 10) u[1] = 11 t.equal(b[1], 11) u[2] = 12 t.equal(b[2], 12) u[3] = 13 t.equal(b[3], 13) } t.end() }) test('new buffer from Uint8Array', function (t) { if (typeof Uint8Array !== 'undefined') { var b1 = new Uint8Array([0, 1, 2, 3]) var b2 = new B(b1) t.equal(b1.length, b2.length) t.equal(b1[0], 0) t.equal(b1[1], 1) t.equal(b1[2], 2) t.equal(b1[3], 3) t.equal(b1[4], undefined) } t.end() }) test('new buffer from Uint16Array', function (t) { if (typeof Uint16Array !== 'undefined') { var b1 = new Uint16Array([0, 1, 2, 3]) var b2 = new B(b1) t.equal(b1.length, b2.length) t.equal(b1[0], 0) t.equal(b1[1], 1) t.equal(b1[2], 2) t.equal(b1[3], 3) t.equal(b1[4], undefined) } t.end() }) test('new buffer from Uint32Array', function (t) { if (typeof Uint32Array !== 'undefined') { var b1 = new Uint32Array([0, 1, 2, 3]) var b2 = new B(b1) t.equal(b1.length, b2.length) t.equal(b1[0], 0) t.equal(b1[1], 1) t.equal(b1[2], 2) t.equal(b1[3], 3) t.equal(b1[4], undefined) } t.end() }) test('new buffer from Int16Array', function (t) { if (typeof Int16Array !== 'undefined') { var b1 = new Int16Array([0, 1, 2, 3]) var b2 = new B(b1) t.equal(b1.length, b2.length) t.equal(b1[0], 0) t.equal(b1[1], 1) t.equal(b1[2], 2) t.equal(b1[3], 3) t.equal(b1[4], undefined) } t.end() }) test('new buffer from Int32Array', function (t) { if (typeof Int32Array !== 'undefined') { var b1 = new Int32Array([0, 1, 2, 3]) var b2 = new B(b1) t.equal(b1.length, b2.length) t.equal(b1[0], 0) t.equal(b1[1], 1) t.equal(b1[2], 2) t.equal(b1[3], 3) t.equal(b1[4], undefined) } t.end() }) test('new buffer from Float32Array', function (t) { if (typeof Float32Array !== 'undefined') { var b1 = new Float32Array([0, 1, 2, 3]) var b2 = new B(b1) t.equal(b1.length, b2.length) t.equal(b1[0], 0) t.equal(b1[1], 1) t.equal(b1[2], 2) t.equal(b1[3], 3) t.equal(b1[4], undefined) } t.end() }) test('new buffer from Float64Array', function (t) { if (typeof Float64Array !== 'undefined') { var b1 = new Float64Array([0, 1, 2, 3]) var b2 = new B(b1) t.equal(b1.length, b2.length) t.equal(b1[0], 0) t.equal(b1[1], 1) t.equal(b1[2], 2) t.equal(b1[3], 3) t.equal(b1[4], undefined) } t.end() }) test('new buffer from buffer.toJSON() output', function (t) { if (typeof JSON === 'undefined') { // ie6, ie7 lack support t.end() return } var buf = new B('test') var json = JSON.stringify(buf) var obj = JSON.parse(json) var copy = new B(obj) t.ok(buf.equals(copy)) t.end() })