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

Instructions for using the buffer.fill method in node.js_node.js

WBOY
Release: 2016-05-16 16:27:17
Original
1888 people have browsed it

Method description:

Fill the specified data into the buffer.

Grammar:

Copy code The code is as follows:

buffer.fill(value, [offset], [end])

Receive parameters:

value The data to be filled

offet The starting position of the filled data. If not specified, the default is 0

end The end position of the padding data. If not specified, the default is the length of the buffer.

Example:

Copy code The code is as follows:

//In Example 1, the starting and ending positions of the filling content are not specified
var b = new Buffer(50);
b.fill("h");

//In Example 2, the starting and ending positions of the filling content are specified
var b = new Buffer(50);
var len = b.length;
b.fill("h" , len-1 , len);
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