[Jscript] Analog to fread? How to get values from an array of bytes?

Hello,

I am trying to write my own parser of some binary format. So far I managed to open the file and get all its bytes in to an array. I need somehow start getting values out of it (data).

import System;
import System.IO;

function Start () {
var _mainPath : String = "Assets/HarrisStuff/clouds/";
var _cloudPath : String = Path.Combine(_mainPath,"cloud0.dat");
//Debug.Log(_cloudPath);
    if (File.Exists(_cloudPath) )
    {
        var data : byte[];
        data = File.ReadAllBytes(_cloudPath);
            
        print(data.length);
                
    }
    else
    {
        Debug.Log("Invalid file name");
    }
    
//print(File.Exists(_cloudPath));
}

Alternatively I am looking for smth fimilar to fread function. So I could parse it.In other words how can I do this in Jscript:

fread(&MyVariable, sizeof(SomeDataType), 1, the file);

check out System.IO.File as well as System.Serializable

both on microsofts MSDN and like C# unless you want to use the docs on any of the other .net languages.
you work with .net functionality on any of that, not other “javascript alike things”. (its now officially called UnityScript by the way to make clear that it has basically nothing to do with javascript at all)

ah ok thanks, now I use filestream