Convertation of arbitrary type javascript data to binary