doc: mark optional parameters in buffer.md · nodejs/node@3567ff1 (original) (raw)
`@@ -1541,8 +1541,8 @@ deprecated: v8.0.0
`
1541
1541
``
1542
1542
`` The buf.parent
property is a deprecated alias for buf.buffer
.
``
1543
1543
``
1544
``
`-
buf.readDoubleBE(offset)
`
1545
``
`-
buf.readDoubleLE(offset)
`
``
1544
`+
buf.readDoubleBE([offset])
`
``
1545
`+
buf.readDoubleLE([offset])
`
1546
1546
`<!-- YAML
`
1547
1547
`added: v0.11.15
`
1548
1548
`changes:
`
`@@ -1553,7 +1553,7 @@ changes:
`
1553
1553
`-->
`
1554
1554
``
1555
1555
`` * offset
{integer} Number of bytes to skip before starting to read. Must
``
1556
``
`` -
satisfy 0 <= offset <= buf.length - 8
.
``
``
1556
`` +
satisfy 0 <= offset <= buf.length - 8
. Default: 0
.
``
1557
1557
`* Returns: {number}
`
1558
1558
``
1559
1559
`` Reads a 64-bit double from buf
at the specified offset
with specified
``
`@@ -1571,8 +1571,8 @@ console.log(buf.readDoubleLE(1));
`
1571
1571
`// Throws ERR_OUT_OF_RANGE
`
1572
1572
```` ```
`1573`
`1573`
``
`1574`
``
`-
### buf.readFloatBE(offset)
`
`1575`
``
`-
### buf.readFloatLE(offset)
`
``
`1574`
`+
### buf.readFloatBE([offset])
`
``
`1575`
`+
### buf.readFloatLE([offset])
`
`1576`
`1576`
`<!-- YAML
`
`1577`
`1577`
`added: v0.11.15
`
`1578`
`1578`
`changes:
`
`@@ -1583,7 +1583,7 @@ changes:
`
`1583`
`1583`
`-->
`
`1584`
`1584`
``
`1585`
`1585`
`` * `offset` {integer} Number of bytes to skip before starting to read. Must
``
`1586`
``
`` -
satisfy `0 <= offset <= buf.length - 4`.
``
``
`1586`
`` +
satisfy `0 <= offset <= buf.length - 4`. **Default:** `0`.
``
`1587`
`1587`
`* Returns: {number}
`
`1588`
`1588`
``
`1589`
`1589`
`` Reads a 32-bit float from `buf` at the specified `offset` with specified
``
`@@ -1601,7 +1601,7 @@ console.log(buf.readFloatLE(1));
`
`1601`
`1601`
`// Throws ERR_OUT_OF_RANGE
`
`1602`
`1602`
```` ```
1603
1603
``
1604
``
`-
buf.readInt8(offset)
`
``
1604
`+
buf.readInt8([offset])
`
1605
1605
`<!-- YAML
`
1606
1606
`added: v0.5.0
`
1607
1607
`changes:
`
`@@ -1612,7 +1612,7 @@ changes:
`
1612
1612
`-->
`
1613
1613
``
1614
1614
`` * offset
{integer} Number of bytes to skip before starting to read. Must
``
1615
``
`` -
satisfy 0 <= offset <= buf.length - 1
.
``
``
1615
`` +
satisfy 0 <= offset <= buf.length - 1
. Default: 0
.
``
1616
1616
`* Returns: {integer}
`
1617
1617
``
1618
1618
`` Reads a signed 8-bit integer from buf
at the specified offset
.
``
`@@ -1630,8 +1630,8 @@ console.log(buf.readInt8(2));
`
1630
1630
`// Throws ERR_OUT_OF_RANGE
`
1631
1631
```` ```
`1632`
`1632`
``
`1633`
``
`-
### buf.readInt16BE(offset)
`
`1634`
``
`-
### buf.readInt16LE(offset)
`
``
`1633`
`+
### buf.readInt16BE([offset])
`
``
`1634`
`+
### buf.readInt16LE([offset])
`
`1635`
`1635`
`<!-- YAML
`
`1636`
`1636`
`added: v0.5.5
`
`1637`
`1637`
`changes:
`
`@@ -1642,7 +1642,7 @@ changes:
`
`1642`
`1642`
`-->
`
`1643`
`1643`
``
`1644`
`1644`
`` * `offset` {integer} Number of bytes to skip before starting to read. Must
``
`1645`
``
`` -
satisfy `0 <= offset <= buf.length - 2`.
``
``
`1645`
`` +
satisfy `0 <= offset <= buf.length - 2`. **Default:** `0`.
``
`1646`
`1646`
`* Returns: {integer}
`
`1647`
`1647`
``
`1648`
`1648`
`` Reads a signed 16-bit integer from `buf` at the specified `offset` with
``
`@@ -1662,8 +1662,8 @@ console.log(buf.readInt16LE(1));
`
`1662`
`1662`
`// Throws ERR_OUT_OF_RANGE
`
`1663`
`1663`
```` ```
1664
1664
``
1665
``
`-
buf.readInt32BE(offset)
`
1666
``
`-
buf.readInt32LE(offset)
`
``
1665
`+
buf.readInt32BE([offset])
`
``
1666
`+
buf.readInt32LE([offset])
`
1667
1667
`<!-- YAML
`
1668
1668
`added: v0.5.5
`
1669
1669
`changes:
`
`@@ -1674,7 +1674,7 @@ changes:
`
1674
1674
`-->
`
1675
1675
``
1676
1676
`` * offset
{integer} Number of bytes to skip before starting to read. Must
``
1677
``
`` -
satisfy 0 <= offset <= buf.length - 4
.
``
``
1677
`` +
satisfy 0 <= offset <= buf.length - 4
. Default: 0
.
``
1678
1678
`* Returns: {integer}
`
1679
1679
``
1680
1680
`` Reads a signed 32-bit integer from buf
at the specified offset
with
``
`@@ -1728,7 +1728,7 @@ console.log(buf.readIntBE(1, 0).toString(16));
`
1728
1728
`// Throws ERR_OUT_OF_RANGE
`
1729
1729
```` ```
`1730`
`1730`
``
`1731`
``
`-
### buf.readUInt8(offset)
`
``
`1731`
`+
### buf.readUInt8([offset])
`
`1732`
`1732`
`<!-- YAML
`
`1733`
`1733`
`added: v0.5.0
`
`1734`
`1734`
`changes:
`
`@@ -1739,7 +1739,7 @@ changes:
`
`1739`
`1739`
`-->
`
`1740`
`1740`
``
`1741`
`1741`
`` * `offset` {integer} Number of bytes to skip before starting to read. Must
``
`1742`
``
`` -
satisfy `0 <= offset <= buf.length - 1`.
``
``
`1742`
`` +
satisfy `0 <= offset <= buf.length - 1`. **Default:** `0`.
``
`1743`
`1743`
`* Returns: {integer}
`
`1744`
`1744`
``
`1745`
`1745`
`` Reads an unsigned 8-bit integer from `buf` at the specified `offset`.
``
`@@ -1755,8 +1755,8 @@ console.log(buf.readUInt8(2));
`
`1755`
`1755`
`// Throws ERR_OUT_OF_RANGE
`
`1756`
`1756`
```` ```
1757
1757
``
1758
``
`-
buf.readUInt16BE(offset)
`
1759
``
`-
buf.readUInt16LE(offset)
`
``
1758
`+
buf.readUInt16BE([offset])
`
``
1759
`+
buf.readUInt16LE([offset])
`
1760
1760
`<!-- YAML
`
1761
1761
`added: v0.5.5
`
1762
1762
`changes:
`
`@@ -1767,7 +1767,7 @@ changes:
`
1767
1767
`-->
`
1768
1768
``
1769
1769
`` * offset
{integer} Number of bytes to skip before starting to read. Must
``
1770
``
`` -
satisfy 0 <= offset <= buf.length - 2
.
``
``
1770
`` +
satisfy 0 <= offset <= buf.length - 2
. Default: 0
.
``
1771
1771
`* Returns: {integer}
`
1772
1772
``
1773
1773
`` Reads an unsigned 16-bit integer from buf
at the specified offset
with
``
`@@ -1789,8 +1789,8 @@ console.log(buf.readUInt16LE(2).toString(16));
`
1789
1789
`// Throws ERR_OUT_OF_RANGE
`
1790
1790
```` ```
`1791`
`1791`
``
`1792`
``
`-
### buf.readUInt32BE(offset)
`
`1793`
``
`-
### buf.readUInt32LE(offset)
`
``
`1792`
`+
### buf.readUInt32BE([offset])
`
``
`1793`
`+
### buf.readUInt32LE([offset])
`
`1794`
`1794`
`<!-- YAML
`
`1795`
`1795`
`added: v0.5.5
`
`1796`
`1796`
`changes:
`
`@@ -1801,7 +1801,7 @@ changes:
`
`1801`
`1801`
`-->
`
`1802`
`1802`
``
`1803`
`1803`
`` * `offset` {integer} Number of bytes to skip before starting to read. Must
``
`1804`
``
`` -
satisfy `0 <= offset <= buf.length - 4`.
``
``
`1804`
`` +
satisfy `0 <= offset <= buf.length - 4`. **Default:** `0`.
``
`1805`
`1805`
`* Returns: {integer}
`
`1806`
`1806`
``
`1807`
`1807`
`` Reads an unsigned 32-bit integer from `buf` at the specified `offset` with
``
`` @@ -2144,8 +2144,8 @@ console.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`);
``
`2144`
`2144`
`// Prints: 12 bytes: ½ + ¼ = ¾
`
`2145`
`2145`
```` ```
2146
2146
``
2147
``
`-
buf.writeDoubleBE(value, offset)
`
2148
``
`-
buf.writeDoubleLE(value, offset)
`
``
2147
`+
buf.writeDoubleBE(value[, offset])
`
``
2148
`+
buf.writeDoubleLE(value[, offset])
`
2149
2149
`<!-- YAML
`
2150
2150
`added: v0.11.15
`
2151
2151
`changes:
`
`@@ -2157,7 +2157,7 @@ changes:
`
2157
2157
``
2158
2158
`` * value
{number} Number to be written to buf
.
``
2159
2159
`` * offset
{integer} Number of bytes to skip before starting to write. Must
``
2160
``
`` -
satisfy 0 <= offset <= buf.length - 8
.
``
``
2160
`` +
satisfy 0 <= offset <= buf.length - 8
. Default: 0
.
``
2161
2161
`` * Returns: {integer} offset
plus the number of bytes written.
``
2162
2162
``
2163
2163
`` Writes value
to buf
at the specified offset
with specified endian
``
`@@ -2179,8 +2179,8 @@ console.log(buf);
`
2179
2179
`// Prints: <Buffer 77 be 9f 1a 2f dd 5e 40>
`
2180
2180
```` ```
`2181`
`2181`
``
`2182`
``
`-
### buf.writeFloatBE(value, offset)
`
`2183`
``
`-
### buf.writeFloatLE(value, offset)
`
``
`2182`
`+
### buf.writeFloatBE(value[, offset])
`
``
`2183`
`+
### buf.writeFloatLE(value[, offset])
`
`2184`
`2184`
`<!-- YAML
`
`2185`
`2185`
`added: v0.11.15
`
`2186`
`2186`
`changes:
`
`@@ -2192,7 +2192,7 @@ changes:
`
`2192`
`2192`
``
`2193`
`2193`
`` * `value` {number} Number to be written to `buf`.
``
`2194`
`2194`
`` * `offset` {integer} Number of bytes to skip before starting to write. Must
``
`2195`
``
`` -
satisfy `0 <= offset <= buf.length - 4`.
``
``
`2195`
`` +
satisfy `0 <= offset <= buf.length - 4`. **Default:** `0`.
``
`2196`
`2196`
`` * Returns: {integer} `offset` plus the number of bytes written.
``
`2197`
`2197`
``
`2198`
`2198`
`` Writes `value` to `buf` at the specified `offset` with specified endian
``
`@@ -2214,7 +2214,7 @@ console.log(buf);
`
`2214`
`2214`
`// Prints: <Buffer bb fe 4a 4f>
`
`2215`
`2215`
```` ```
2216
2216
``
2217
``
`-
buf.writeInt8(value, offset)
`
``
2217
`+
buf.writeInt8(value[, offset])
`
2218
2218
`<!-- YAML
`
2219
2219
`added: v0.5.0
`
2220
2220
`changes:
`
`@@ -2226,7 +2226,7 @@ changes:
`
2226
2226
``
2227
2227
`` * value
{integer} Number to be written to buf
.
``
2228
2228
`` * offset
{integer} Number of bytes to skip before starting to write. Must
``
2229
``
`` -
satisfy 0 <= offset <= buf.length - 1
.
``
``
2229
`` +
satisfy 0 <= offset <= buf.length - 1
. Default: 0
.
``
2230
2230
`` * Returns: {integer} offset
plus the number of bytes written.
``
2231
2231
``
2232
2232
`` Writes value
to buf
at the specified offset
. value
should be a valid
``
`@@ -2245,8 +2245,8 @@ console.log(buf);
`
2245
2245
`// Prints: <Buffer 02 fe>
`
2246
2246
```` ```
`2247`
`2247`
``
`2248`
``
`-
### buf.writeInt16BE(value, offset)
`
`2249`
``
`-
### buf.writeInt16LE(value, offset)
`
``
`2248`
`+
### buf.writeInt16BE(value[, offset])
`
``
`2249`
`+
### buf.writeInt16LE(value[, offset])
`
`2250`
`2250`
`<!-- YAML
`
`2251`
`2251`
`added: v0.5.5
`
`2252`
`2252`
`changes:
`
`@@ -2258,7 +2258,7 @@ changes:
`
`2258`
`2258`
``
`2259`
`2259`
`` * `value` {integer} Number to be written to `buf`.
``
`2260`
`2260`
`` * `offset` {integer} Number of bytes to skip before starting to write. Must
``
`2261`
``
`` -
satisfy `0 <= offset <= buf.length - 2`.
``
``
`2261`
`` +
satisfy `0 <= offset <= buf.length - 2`. **Default:** `0`.
``
`2262`
`2262`
`` * Returns: {integer} `offset` plus the number of bytes written.
``
`2263`
`2263`
``
`2264`
`2264`
`` Writes `value` to `buf` at the specified `offset` with specified endian
``
`@@ -2278,8 +2278,8 @@ console.log(buf);
`
`2278`
`2278`
`// Prints: <Buffer 01 02 04 03>
`
`2279`
`2279`
```` ```
2280
2280
``
2281
``
`-
buf.writeInt32BE(value, offset)
`
2282
``
`-
buf.writeInt32LE(value, offset)
`
``
2281
`+
buf.writeInt32BE(value[, offset])
`
``
2282
`+
buf.writeInt32LE(value[, offset])
`
2283
2283
`<!-- YAML
`
2284
2284
`added: v0.5.5
`
2285
2285
`changes:
`
`@@ -2291,7 +2291,7 @@ changes:
`
2291
2291
``
2292
2292
`` * value
{integer} Number to be written to buf
.
``
2293
2293
`` * offset
{integer} Number of bytes to skip before starting to write. Must
``
2294
``
`` -
satisfy 0 <= offset <= buf.length - 4
.
``
``
2294
`` +
satisfy 0 <= offset <= buf.length - 4
. Default: 0
.
``
2295
2295
`` * Returns: {integer} offset
plus the number of bytes written.
``
2296
2296
``
2297
2297
`` Writes value
to buf
at the specified offset
with specified endian
``
`@@ -2347,7 +2347,7 @@ console.log(buf);
`
2347
2347
`// Prints: <Buffer ab 90 78 56 34 12>
`
2348
2348
```` ```
`2349`
`2349`
``
`2350`
``
`-
### buf.writeUInt8(value, offset)
`
``
`2350`
`+
### buf.writeUInt8(value[, offset])
`
`2351`
`2351`
`<!-- YAML
`
`2352`
`2352`
`added: v0.5.0
`
`2353`
`2353`
`changes:
`
`@@ -2359,7 +2359,7 @@ changes:
`
`2359`
`2359`
``
`2360`
`2360`
`` * `value` {integer} Number to be written to `buf`.
``
`2361`
`2361`
`` * `offset` {integer} Number of bytes to skip before starting to write. Must
``
`2362`
``
`` -
satisfy `0 <= offset <= buf.length - 1`.
``
``
`2362`
`` +
satisfy `0 <= offset <= buf.length - 1`. **Default:** `0`.
``
`2363`
`2363`
`` * Returns: {integer} `offset` plus the number of bytes written.
``
`2364`
`2364`
``
`2365`
`2365`
`` Writes `value` to `buf` at the specified `offset`. `value` *should* be a
``
`@@ -2378,8 +2378,8 @@ console.log(buf);
`
`2378`
`2378`
`// Prints: <Buffer 03 04 23 42>
`
`2379`
`2379`
```` ```
2380
2380
``
2381
``
`-
buf.writeUInt16BE(value, offset)
`
2382
``
`-
buf.writeUInt16LE(value, offset)
`
``
2381
`+
buf.writeUInt16BE(value[, offset])
`
``
2382
`+
buf.writeUInt16LE(value[, offset])
`
2383
2383
`<!-- YAML
`
2384
2384
`added: v0.5.5
`
2385
2385
`changes:
`
`@@ -2391,7 +2391,7 @@ changes:
`
2391
2391
``
2392
2392
`` * value
{integer} Number to be written to buf
.
``
2393
2393
`` * offset
{integer} Number of bytes to skip before starting to write. Must
``
2394
``
`` -
satisfy 0 <= offset <= buf.length - 2
.
``
``
2394
`` +
satisfy 0 <= offset <= buf.length - 2
. Default: 0
.
``
2395
2395
`` * Returns: {integer} offset
plus the number of bytes written.
``
2396
2396
``
2397
2397
`` Writes value
to buf
at the specified offset
with specified endian
``
`@@ -2415,8 +2415,8 @@ console.log(buf);
`
2415
2415
`// Prints:
`
2416
2416
```` ```
````
2417
2417
``
2418
``
`-
buf.writeUInt32BE(value, offset)
`
2419
``
`-
buf.writeUInt32LE(value, offset)
`
``
2418
`+
buf.writeUInt32BE(value[, offset])
`
``
2419
`+
buf.writeUInt32LE(value[, offset])
`
2420
2420
`<!-- YAML
`
2421
2421
`added: v0.5.5
`
2422
2422
`changes:
`
`@@ -2428,7 +2428,7 @@ changes:
`
2428
2428
``
2429
2429
`` * value
{integer} Number to be written to buf
.
``
2430
2430
`` * offset
{integer} Number of bytes to skip before starting to write. Must
``
2431
``
`` -
satisfy 0 <= offset <= buf.length - 4
.
``
``
2431
`` +
satisfy 0 <= offset <= buf.length - 4
. Default: 0
.
``
2432
2432
`` * Returns: {integer} offset
plus the number of bytes written.
``
2433
2433
``
2434
2434
`` Writes value
to buf
at the specified offset
with specified endian
``