
- Node.js 教程
- Node.js - 首頁
- Node.js - 簡介
- Node.js - 環境搭建
- Node.js - 第一個應用程式
- Node.js - REPL 終端
- Node.js - 命令列選項
- Node.js - 包管理器 (NPM)
- Node.js - 回撥函式概念
- Node.js - 上傳檔案
- Node.js - 傳送電子郵件
- Node.js - 事件
- Node.js - 事件迴圈
- Node.js - 事件發射器
- Node.js - 偵錯程式
- Node.js - 全域性物件
- Node.js - 控制檯
- Node.js - 程序
- Node.js - 應用程式擴充套件
- Node.js - 打包
- Node.js - Express 框架
- Node.js - RESTFul API
- Node.js - 緩衝區
- Node.js - 流
- Node.js - 檔案系統
- Node.js MySQL
- Node.js - MySQL 入門
- Node.js - MySQL 建立資料庫
- Node.js - MySQL 建立表
- Node.js - MySQL 插入資料
- Node.js - MySQL 從表中選擇資料
- Node.js - MySQL Where 條件
- Node.js - MySQL 排序
- Node.js - MySQL 刪除資料
- Node.js - MySQL 更新資料
- Node.js - MySQL 聯接
- Node.js MongoDB
- Node.js - MongoDB 入門
- Node.js - MongoDB 建立資料庫
- Node.js - MongoDB 建立集合
- Node.js - MongoDB 插入資料
- Node.js - MongoDB 查詢資料
- Node.js - MongoDB 查詢
- Node.js - MongoDB 排序
- Node.js - MongoDB 刪除資料
- Node.js - MongoDB 更新資料
- Node.js - MongoDB 限制結果
- Node.js - MongoDB 聯接
- Node.js 模組
- Node.js - 模組
- Node.js - 內建模組
- Node.js - 實用程式模組
- Node.js - Web 模組
- Node.js 有用資源
- Node.js - 快速指南
- Node.js - 有用資源
- Node.js - 討論
Node.js - Buffer.buffer 屬性
NodeJS 的 buf.buffer 是 NodeJS Buffer 模組中 Buffer 類的一個屬性。此屬性將為您提供一個數組緩衝區的物件,並由此建立的緩衝區將與陣列緩衝區相同。
語法
以下是 NodeJS 緩衝區屬性的語法:
Buffer.buffer
示例
在本例中,我們將建立一個緩衝區並檢視 NodeJS Buffer.buffer 的輸出。
const buf = Buffer.from('Hello World'); console.log(buf.buffer);
輸出
ArrayBuffer { [Uint8Contents]: <63 6f 6e 73 74 20 62 75 66 20 3d 20 42 75 66 66 65 72 2e 66 72 6f 6d 28 27 48 65 6c 6c 6f 20 57 6f 72 6c 64 27 29 3b 0d 0a 0d 0a 63 6f 6e 73 6f 6c 65 2e 6c 6f 67 28 62 75 66 2e 62 75 66 66 65 72 29 3b 0d 0a 02 00 00 48 65 6c 6c 6f 20 57 6f 72 6c 64 45 48 02 00 00 08 00 00 00 01 00 00 00 08 07 00 00 ... 8092 more bytes>, byteLength: 8192 }
示例
在本例中,讓我們建立一個數組緩衝區,然後從中建立一個緩衝區。並比較兩者。
const arrofbuff = new ArrayBuffer(16); const buff = Buffer.from(arrofbuff); if (buff.buffer === arrofbuff) { console.log("Buffer and array buffer are equivalent"); }
輸出
Buffer and array buffer are equivalent
nodejs_buffer_module.htm
廣告