2023-02-26 01:30

This commit is contained in:
2023-02-26 01:30:37 +09:00
commit 9a13ccbd17
122 changed files with 32148 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
// 0으로 초기화됨.
const buffer = Buffer.alloc(1024);
//or 초기화 없음
// buffer = Buffer.allocUnsafe(1024);
buffer.write('Hi.');
console.log(buffer.toString());
const buff = Buffer.from('Hello');
console.log(buff[0]);
console.log(buff.length);
console.log(buff.toString());
for (const c of buff) {
console.log(c);
}
// copy
let buf2 = Buffer.alloc(2);
buffer.copy(buf2, 0, 0, 2);
// slice
console.log(buffer.slice(0, 2).toString());