ES2.SaveRaw
Save Raw Bytes
public static void SaveRaw(byte[] bytes, string path, ES2Settings settings=null)
Parameters
[table th=”0″]bytes,”The raw bytes which we want to save as our file.”
path,”The path of the file we want to create to store our data. For more information, see Paths.”
settings,”Optional. A user-created ES2Settings object containing options not specified in path.”[/table]
Description
Saves a file containing our raw bytes.
Note: Path should point to a file.
C#
// Create a file containing only the bytes ABC123. byte[] bytes = new byte[]{'A','B','C','1','2','3'}; ES2.SaveRaw(bytes, "myFile.txt");
JS
// Create a file containing only the bytes ABC123. var bytes = ['A','B','C','1','2','3']; ES2.SaveRaw(bytes, "myFile.txt");
Save Raw String
public static void SaveRaw(string data, string path, ES2Settings settings=null)
Parameters
[table th=”0″]data,”The raw string representing our file. It will be stored in the UTF8 encoding.”
path,”The path of the file we want to create to store our data. For more information, see Paths.”
settings,”Optional. A user-created ES2Settings object containing options not specified in path.”[/table]
Description
Saves a file containing our raw UTF8 string.
Note: Path should point to a file.
C#
// Create a file containing our own text. ES2.SaveRaw("String we want to save.", "myFile.txt");
JS
// Create a file containing our own text. ES2.SaveRaw("String we want to save.", "myFile.txt");
Save Raw Text Asset
public static void SaveRaw(TextAsset data, string path, ES2Settings settings=null)
Parameters
[table th=”0″]data,”The TextAsset we want to save as a file.”
path,”The path of the file we want to create to store our data, which should have the extension .bytes. For more information, see Paths.”
settings,”Optional. A user-created ES2Settings object containing options not specified in path.”[/table]
Description
Saves a TextAsset as a file which will contain the same bytes as the TextAsset.
Note: The TextAsset must have the extension ‘.bytes’.
Note: Path should point to a file.
C#
// Create a file containing only the bytes ABC123. TextAsset file = Resources.Load("myFile") as TextAsset; ES2.SaveRaw(file, "myFile.txt");
JS
// Create a file containing only the bytes ABC123. var file = Resources.Load("myFile") as TextAsset; ES2.SaveRaw(file, "myFile.txt");