Saving a Uint8Array to a binary file

These are utilities that I use to download files cross-browser. The nifty thing about this is that you can actually set the download property of a link to the name you want your filename to be. FYI the mimeType for binary is application/octet-stream var downloadBlob, downloadURL; downloadBlob = function(data, fileName, mimeType) { var blob, url; … Read more

Prune binary data from a git repository after the fact

The solution in this answer worked perfectly for me: You can also test your clean process with a tool like bfg repo cleaner, as in this answer: java -jar bfg.jar –delete-files *.{jpg,png,mp4,m4v,ogv,webm} ${bare-repo-dir}; (Except BFG makes sure it doesn’t delete anything in your latest commit, so you need to remove those files in the current … Read more

convert binary string to numpy array

>>> np.frombuffer(b’\x00\x00\x80?\x00\x00\x00@\x00\x00@@\x00\x00\x80@’, dtype=”<f4″) # or dtype=np.dtype(‘<f4′), or np.float32 on a little-endian system (which most computers are these days) array([ 1., 2., 3., 4.], dtype=float32) Or, if you want big-endian: >>> np.frombuffer(b’\x00\x00\x80?\x00\x00\x00@\x00\x00@@\x00\x00\x80@’, dtype=”>f4″) # or dtype=np.dtype(‘>f4′), or np.float32 on a big-endian system array([ 4.60060299e-41, 8.96831017e-44, 2.30485571e-41, 4.60074312e-41], dtype=float32) The b isn’t necessary prior to Python 3, … Read more

Meaning of a Common String In Executables?

Interesting question. Since I didn’t know the answer, here are the steps I took to figure it out: Where in the file does the string occur? strings -otx /bin/gzip | grep AWAVAUATUSH 35e0 AWAVAUATUSH 69a0 AWAVAUATUSH 7920 AWAVAUATUSH 8900 AWAVAUATUSH 92a0 AWAVAUATUSH Which section is that in? readelf -WS /bin/gzip There are 28 section headers, … Read more

What is the most efficient binary to text encoding?

This really depends on the nature of the binary data, and the constraints that “text” places on your output. First off, if your binary data is not compressed, try compressing before encoding. We can then assume that the distribution of 1/0 or individual bytes is more or less random. Now: why do you need text? … Read more

best approach to design a rest web service with binary data to be consumed from the browser

My research results: Single request (data included) The request contains metadata. The data is a property of metadata and encoded (for example: Base64). Pros: transactional everytime valid (no missing metadata or data) Cons: encoding makes the request very large Examples: Twitter GitHub Imgur Single request (multipart) The request contains one or more parts with metadata … Read more