Software: Apache. PHP/8.1.30 uname -a: Linux server1.tuhinhossain.com 5.15.0-163-generic #173-Ubuntu SMP Tue Oct 14 17:51:00 UTC uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root) Safe-mode: OFF (not secure) /home/picotech/domains/inventory.picotech.app/public_html/node_modules/buffer/test/ drwxr-xr-x | |
| Viewing file: Select action/file-type: if (process.env.OBJECT_IMPL) global.TYPED_ARRAY_SUPPORT = false
var B = require('../').Buffer
var test = require('tape')
test('modifying buffer created by .slice() modifies original memory', function (t) {
if (!B.TYPED_ARRAY_SUPPORT) return t.end()
var buf1 = new B(26)
for (var i = 0; i < 26; i++) {
buf1[i] = i + 97 // 97 is ASCII a
}
var buf2 = buf1.slice(0, 3)
t.equal(buf2.toString('ascii', 0, buf2.length), 'abc')
buf2[0] = '!'.charCodeAt(0)
t.equal(buf1.toString('ascii', 0, buf2.length), '!bc')
t.end()
})
test('modifying parent buffer modifies .slice() buffer\'s memory', function (t) {
if (!B.TYPED_ARRAY_SUPPORT) return t.end()
var buf1 = new B(26)
for (var i = 0; i < 26; i++) {
buf1[i] = i + 97 // 97 is ASCII a
}
var buf2 = buf1.slice(0, 3)
t.equal(buf2.toString('ascii', 0, buf2.length), 'abc')
buf1[0] = '!'.charCodeAt(0)
t.equal(buf2.toString('ascii', 0, buf2.length), '!bc')
t.end()
})
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0035 ]-- |