Getting the dimensions of a texture

I am making a function which takes a texture and outputs it’s contents as a float array (for debugging only. I know its slow).
For this I need to get the width and height of the texture. (to create a float array which has the same size as the texture).
OpenGl uses this:,
but that does not seem to work in webgl.

How do I retrieve information about a texture?