7

I want to design and write a 3d image viewing web application in JavaScript. I've already written it in java and flash and basically want to port it. I want the 3d image export files to be in a binary format just like the Java and flash versions I've written however, I'm unsure if JavaScript can handle data in binary format efficiently. Can JavaScript handle binary data quickly? How good/bad is it at handling compared with Java and Flash?

Zeeno
  • 2,671
  • 9
  • 37
  • 60

2 Answers2

5

JavaScript can handle binary data via typed arrays. And here is a library for dealing with binary files, that you can use as a reference point for your application.

How quick is JavaScript - I'm not sure that this is the right question. It depends on browser, and user`s machine.

metadaddy
  • 4,234
  • 1
  • 22
  • 46
Bakudan
  • 19,134
  • 9
  • 53
  • 73
4

As @Bakudan said, you can use the TypedArrays.

Most modern browsers support the DataView API, which provides you random access to ArrayBuffers.

As addition, you can use BlobReader to process blobs.

The whole process of parsing binary protocols (Blobs, ArrayBuffers, DataViews, TypedArrays, Binary Data over WebSockets) is described in this blog post.

Minko Gechev
  • 25,304
  • 9
  • 61
  • 68