Hello everyone!
I'm actually trying to make an export script and I'm facing some limits of Daz DSA Scripts.
Basically the format need to be a single JSON containing various properties and objects, so I retrieve geometry, materials, etc into a single object then "JSON.stringify" it.
The string holding the JSON is actually around 4 Go, that is what "String.length" is reporting :
2022-11-09 01:56:18.623 [DEBUG] :: str.length: 4189042444
To save this huge string into a file, i've tried various methods :
1) A single DZFile; but "fwrite" report "0" and the file is empty too, so no contents have been written :
var fwrite = fp.write(str);
2) Chunk it into multiple 32Kb parts ; but again, fp.write report "0" and the file is still empty :
var str = "// big json //";
var size = 32 * 1000;
var numChunks = Math.ceil(str.length / size);
var fp = new DzFile(filepath);
fp.open(DzFile.WriteOnly);
for (var i = 0, o = 0; i < numChunks; ++i, o += size) {
var chunk = str.substr(o, size);
var fwrite = fp.write(chunk);
}
In this case, RAM is not a problem and i don't care about optimisation, I just want to save this huge string into a file
Is there a limitation in how DAZ handles Strings or file writes ? I'm not sure i've found such information in the documentations.
Thanks for your help!