Re: [whatwg/encoding] Fast byteLength() (Issue #333)

I suspect that this API might be used to determine the length of the buffer to use for `encodeInto()`, which it is not a good fit for, since it would iterate through the string twice unnecessarily. If we think it is useful to add this API, maybe we should also add another `maxByteLength` method that simply returns `3 * string.length`, to try and steer developers to the right usage patterns.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/encoding/issues/333#issuecomment-2283890740
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/encoding/issues/333/2283890740@github.com>

Received on Monday, 12 August 2024 12:46:44 UTC