Version: v13.11.0
Platform: Windows 10
Subsystem: Buffer
Buffer.write is inconsistent with the other Buffer write methods because it doesn't return the offset only the bytes written.
Indeed, the return value looks inconsistent with other write* methods. Most likely that's because write was added in v0.1.90, while other methods are much newer. Unfortunately, changing this logic will break backwards compatibility, so I'm not sure if it should be fixed.
Maybe a deprecation cycle will help here?
@rexagod Realistically, we can鈥檛 just deprecate this method altogether, and there鈥檚 no good way to specifically attach a deprecation warning to the return value, and even if we did, there would be no good transition path to the consistent variant for users, and even if there was, moving existing npm ecosystem usage would take years, with a lot of annoyance for end users.
@puzpuzpuz is right here, this is a bit unfortunate but there鈥檚 nothing we can do about it at this point. I鈥檒l close this.
Most helpful comment
Indeed, the return value looks inconsistent with other
write*methods. Most likely that's becausewritewas added in v0.1.90, while other methods are much newer. Unfortunately, changing this logic will break backwards compatibility, so I'm not sure if it should be fixed.