Looking at the BlobBuilder API again...

The code, as is, defines an blobBuilder.append method that takes
either a string, or a blob. With the string version (which is always
interpreted as UTF-8), I can append any byte in the range 0-127 (which
satisfies the multi-part form use case), but not necessarily a byte in
the range 128-255.

Should we also let the append method take an integer (as well as
either a string or a blob, as it currently does), and interpret that
as meaning appending the byte (arg & 0xFF)? Another option is having
three methods appendBlob, appendStringUtf8 and appendByte, but I
prefer the overloaded append method.

Also, if we are allowing appending bytes, should we add a
getByte(int64 index) method to a Gears blob? Whilst I don't have an
immediate need for such an API, I think the symmetry seems like a
natural conclusion from having appendByte, and might also allow for
some interesting experiments, such as client-side SHA-1 calculations.

Reply via email to