Closed mcollina closed 10 years ago
Maybe. I'm not sure how many people still use buffertools; it was originally developed at a time when Buffer was still a bare-bones class but nowadays that class has grown a lot of buffertools-like functionality. Maybe it's better to get the missing pieces upstreamed (compare, search, others?)
I agree.
It's quite used at the moment, it has ~700 downloads a day. Most of those libraries will need special attention for 0.11/0.12 in any case, but reworking a dependency it's harder.
Do you think that a JS-only implementation of this it's too slow?
It would have been at the time when the Buffer class was introduced (the V8 magic backing buffers was almost completely unoptimized back then) but the performance difference is probably within a factor of two or three now.
At any rate, making it compatible with v0.11 isn't that complicated so I did in commit 559ca71 and published it as v2.1.0. Note that it only works with node.js master though, not the last v0.11 release.
Cool, the whole idea is to have it compatible with v0.12 when it comes out later this year.
@bnoordhuis
Maybe it's better to get the missing pieces upstreamed (compare, search, others?)
- [ ]
.clear
— there is.fill(0)
in upstream- [x]
.compare
— should be upstreamed- [ ]
.concat
— there is.concat
in upstream- [x]
.equals
— should be upstreamed- [x]
.fill
— should be upstreamed to improve the upstream's.fill
in a backwards-compatible manner- [ ]
.fromHex
— there isnew Buffer(…, 'hex')
in upstream- [x]
.indexOf
— should be upstreamed- [x]
.reverse
— should be upstreamed- [ ]
.toHex
— there is.toString('hex')
in upstream
.fill — should be upstreamed to improve the upstream's .fill in a backwards-compatible manner
Does buffertools.fill() do anything that Buffer#fill() doesn't? I was under the impression that Trevor had implemented most everything in master.
Does Node.js buffer accept integers, buffers, strings as its fill values?
The documentation does not (currently) say anything about the value's accepted types, though the example demonstrates a 1-character-long string (but not mentioning its implied encoding).
Does Node.js buffer accept integers, buffers, strings as its fill values?
It does though it decodes buffers and strings to UTF-8. I suppose that's one possible enhancement, specifying the encoding.
Also, instead of decoding buffers to UTF-8, it probably should encode strings to buffers and fill buffers with buffers. Would make more sense.
Will this library be updated to v0.11?