如果 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 操作二進制資料的完整文件。
套件管理器
將 bun install 與 Artifactory 搭配使用
設定 git 以 diff Bun 的 lockb lockfile
在 GitHub Actions 中使用 Bun 安裝依賴項
讀取檔案
執行階段
串流
將 ReadableStream 轉換為 Uint8Array
將 ReadableStream 轉換為 ArrayBuffer
將 Node.js Readable 轉換為 Uint8Array
工具程式