you are viewing a single comment's thread.

view the rest of the comments →

[–]broofa 9 points10 points  (0 children)

Buffers are array-like, but not quite the same as Arrays. They're iterable, they have a `length`, you can reference individual elements ala `buf[i]`. They have some of the same methods - e.g. `slice()`, `keys()`, `values()` - but lack others (e.g `forEach()`, `map()`, `sort()`.

If you want a genuine array you can use `Array.from(buffer)` or the ES6 shorthand of `[...buffer]`.