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 930f7a6 commit 99fc75eCopy full SHA for 99fc75e
doc/api/buffer.md
@@ -1253,6 +1253,19 @@ Example: Fill a `Buffer` with a two-byte character
1253
console.log(Buffer.allocUnsafe(3).fill('\u0222'));
1254
```
1255
1256
+If `value` is contains invalid characters, it is truncated; if no valid
1257
+fill data remains, no filling is performed:
1258
+
1259
+```js
1260
+const buf = Buffer.allocUnsafe(5);
1261
+// Prints: <Buffer 61 61 61 61 61>
1262
+console.log(buf.fill('a'));
1263
+// Prints: <Buffer aa aa aa aa aa>
1264
+console.log(buf.fill('aazz', 'hex'));
1265
1266
+console.log(buf.fill('zz', 'hex'));
1267
+```
1268
1269
### buf.includes(value[, byteOffset][, encoding])
1270
<!-- YAML
1271
added: v5.3.0
0 commit comments