Conversation
Previously, this project depended on Node’s buffer. This commit changes that: it replaces that support with `Uint8Array`. In most cases, this will be fine, because the Node `Buffer` class subclasses `Uint8Array`. However, there are differences in which encodings are supported when turning this binary data into a string, and there are differences in how methods work.
What encodings are no longer supported? |
ChristianMurphy
left a comment
There was a problem hiding this comment.
I take it this would be SemVer major?
Are there changes which will be needed in unified?
| new VFile(Buffer.from('bar')).toString(), | ||
| 'bar', | ||
| 'buffer: should return the internal value' | ||
| new VFile(Buffer.from([0xef, 0xbb, 0xbf, 0x61, 0x62, 0x63])).toString(), |
There was a problem hiding this comment.
does this mean buffer from string is no longer supported, and only hex can be used?
|
This is indeed semver major!
depends on how chrome/node/etc is built, see also https://github.com/vfile/vfile/pull/85/files#diff-92bbac9a308cd5fcf9db165841f2d90ce981baddcb2b1e26cfff170929af3bd1R614, so typically everything is supported, but some Node-isms like
nope, those are fine! This just updated the 2 tests to be more clear by using bytes and actually different encodings, instead of already unicode strings So it’s mostly going to be fine! |
Initial checklist
Description of changes
Previously, this project depended on Node’s buffer. This commit changes that: it replaces that support with
Uint8Array. In most cases, this will be fine, because the NodeBufferclass subclassesUint8Array.However, there are differences in which encodings are supported when turning this binary data into a string, and there are differences in how methods work.