Home > Web Front-end > JS Tutorial > Instructions for using the buffer.Buffer.isBuffer method in node.js_node.js

Instructions for using the buffer.Buffer.isBuffer method in node.js_node.js

WBOY
Release: 2016-05-16 16:27:25
Original
1560 people have browsed it

Method description:

Detect whether the target is a buffer object. Will return true or false.

Grammar:

Copy code The code is as follows:

Buffer.isBuffer(obj)

Receive parameters:

obj The object being detected.

Example:

Copy code The code is as follows:

var b = new Buffer(50);

var c = b.toString('base64',0,10);

var d = Buffer.isEncoding('base64');

var e = Buffer.isBuffer(b);

console.log(d);                           //Return false

console.log(e); //Return true

Source code:

Copy code The code is as follows:

// Static methods
Buffer.isBuffer = function isBuffer(b) {
Return util.isBuffer(b);
};
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template