如果 DataView
包含 ASCII 編碼文字,你可以使用 TextDecoder
類別將其轉換為字串。
const dv: DataView = ...;
const decoder = new TextDecoder();
const str = decoder.decode(dv);
請參閱 文件 > API > 二進制資料 以取得使用 Bun 處理二進制資料的完整文件。
如果 DataView
包含 ASCII 編碼文字,你可以使用 TextDecoder
類別將其轉換為字串。
const dv: DataView = ...;
const decoder = new TextDecoder();
const str = decoder.decode(dv);
請參閱 文件 > API > 二進制資料 以取得使用 Bun 處理二進制資料的完整文件。