Fix binary data encoding in js generator