Buffer#fill silently fails when given a string as the first parameter.
Tessel
> a = new Buffer(4)
<Buffer 00 00 00 00>
> a.fill('=')
undefined
> a
<Buffer 00 00 00 00>
Node.js
> a = new Buffer(4)
<Buffer 39 67 81 a3>
> a.fill('=')
undefined
> a
<Buffer 3d 3d 3d 3d>
(Note that node.js dosen't always return a zero-filled buffer which is correct behaviour)
Previous versions of node.js only used the first character of the string (.charCodeAt(0)). It has now been updated to use the entire string when filling. Hopefully we can get the tessel to support more than one character.
I might have dreamed this, it's not in 0.10.x, I haven't installed 0.11.x yet and I didn't find it thru a quick skim of the source (why is fill the only function not defined in lib/buffer.js?). A first implementation could use .charCodeAt(0), that would make it a really quick fix.
Buffer#fill
silently fails when given a string as the first parameter.Tessel
Node.js
(Note that node.js dosen't always return a zero-filled buffer which is correct behaviour)
Previous versions of node.js only used the first character of the string (
.charCodeAt(0)
). It has now been updated to use the entire string when filling. Hopefully we can get the tessel to support more than one character.I might have dreamed this, it's not in0.10.x
, I haven't installed0.11.x
yet and I didn't find it thru a quick skim of the source (why is fill the only function not defined inlib/buffer.js
?). A first implementation could use.charCodeAt(0)
, that would make it a really quick fix.fill
with string used in official tests: https://github.com/joyent/node/blob/857975d5e7e0d7bf38577db0478d9e5ede79922e/test/simple/test-buffer-inspect.js#L32fill
implementation in node.js: https://github.com/joyent/node/blob/master/src/node_buffer.cc#L360