A JS Buffer maxByteLength Solution?

When low-level Web APIs are based on guestimates you already know what the outcome could be: a (very likely slow) mess!