We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 90b257e commit b31626eCopy full SHA for b31626e
doc/api/buffer.md
@@ -1254,6 +1254,19 @@ Example: Fill a `Buffer` with a two-byte character
1254
console.log(Buffer.allocUnsafe(3).fill('\u0222'));
1255
```
1256
1257
+If `value` is contains invalid characters, it is truncated; if no valid
1258
+fill data remains, no filling is performed:
1259
+
1260
+```js
1261
+const buf = Buffer.allocUnsafe(5);
1262
+// Prints: <Buffer 61 61 61 61 61>
1263
+console.log(buf.fill('a'));
1264
+// Prints: <Buffer aa aa aa aa aa>
1265
+console.log(buf.fill('aazz', 'hex'));
1266
1267
+console.log(buf.fill('zz', 'hex'));
1268
+```
1269
1270
### buf.includes(value[, byteOffset][, encoding])
1271
<!-- YAML
1272
added: v5.3.0
0 commit comments