The WHATWG is looking into defining an API around encodings. Bytes in, string out, string in, bytes out, the works. The non-streaming encoder design we are looking at now is as follows (the decoder works analogously):
enc = new Encoder("utf-8") bytes = enc.encode(str)
Streaming would look like:
enc = new Encoder("utf-8") bytes = enc.encode(str, {continues:true})
Anyone with a better name for the continues
dictionary member?