Buffer 클래스는 Buffer 를 문자열로 변환하는 내장 .toString() 메서드를 제공합니다.
ts
const buf = Buffer.from("hello");
const str = buf.toString();
// => "hello"선택적으로 인코딩과 바이트 범위를 지정할 수 있습니다.
ts
const buf = Buffer.from("hello world!");
const str = buf.toString("utf8", 0, 5);
// => "hello"Bun 으로 이진 데이터를 조작하는 방법에 대한 전체 문서는 문서 > API > 이진 데이터 를 참조하세요.