ES2.AppendRaw
Append Raw Bytes
Parameters
bytes | The raw bytes which we want to append to our file. |
path |
The path of the file we want to create to store our data, or append to if it already exists. For more information, see Paths." |
settings |
Optional. A user-created ES2Settings object containing options not specified in path. |
Description
Appends these bytes to the end of the specified file, or creates the file with these bytes if it doesn’t exist.
Note: Path should point to a file.
C#
1 2 3 4 |
// Create a file containing the bytes ABC123ABC123. byte[] bytes = new byte[]{'A','B','C','1','2','3'}; ES2.AppendRaw(bytes, "myFile.txt"); ES2.AppendRaw(bytes, "myFile.txt"); |
JS
1 2 3 4 |
// Create a file containing the bytes ABC123ABC123. var bytes = ['A','B','C','1','2','3']; ES2.AppendRaw(bytes, "myFile.txt"); ES2.AppendRaw(bytes, "myFile.txt"); |
Append Raw String
Parameters
data | The raw string representing to be appended to our file. It will be stored in the UTF8 encoding. |
path |
The path of the file we want to create to store our data, or append to if it already exists. For more information, see Paths." |
settings |
Optional. A user-created ES2Settings object containing options not specified in path. |
Description
Appends this string to the end of the specified file as a UTF8 string, or creates the file with this string if it doesn’t exist.
Note: Path should point to a file.
C#
1 2 3 |
// Create a file containing our own text. ES2.AppendRaw("I think", "myFile.txt"); ES2.AppendRaw("therefore I am.", "myFile.txt"); |
JS
1 2 3 |
// Create a file containing our own text. ES2.AppendRaw("I think", "myFile.txt"); ES2.AppendRaw("therefore I am.", "myFile.txt"); |
Append Raw Text Asset
Parameters
data | The TextAsset we want to append to the file. |
path |
The path of the file we want to create to append our data to, which should have the extension .bytes. For more information, see Paths. |
settings |
Optional. A user-created ES2Settings object containing options not specified in path. |
Description
Saves a TextAsset as a file which will contain the same bytes as the TextAsset, or appends to the file if it already exists.
Note: The TextAsset must have the extension ‘.bytes’.
Note: Path should point to a file.
C#
1 2 3 4 5 |
// Appends one TextAsset to another as a file. TextAsset file1 = Resources.Load("myFile1") as TextAsset; TextAsset file2 = Resources.Load("myFile2") as TextAsset; ES2.AppendRaw(file1, "file1And2.txt"); ES2.AppendRaw(file2, "file1And2.txt"); |
JS
1 2 3 4 5 |
// Appends one TextAsset to another as a file. var file1 : TextAsset = Resources.Load("myFile1") as TextAsset; var file2 : TextAsset = Resources.Load("myFile2") as TextAsset; ES2.AppendRaw(file1, "file1And2.txt"); ES2.AppendRaw(file2, "file1And2.txt"); |