Update Files

This commit is contained in:
2025-01-22 16:18:30 +01:00
parent ed4603cf95
commit a36294b518
16718 changed files with 2960346 additions and 0 deletions

View File

@ -0,0 +1,32 @@
package leenkx.logicnode;
class WriteJsonNode extends LogicNode {
public function new(tree: LogicTree) {
super(tree);
}
override function run(from: Int) {
// Relative or absolute path to file
var file: String = inputs[1].get();
var data: Dynamic = inputs[2].get();
var s = haxe.Json.stringify(data);
#if kha_krom
var path = Krom.getFilesLocation() + "/" + file;
var bytes = haxe.io.Bytes.ofString(s);
Krom.fileSaveBytes(path, bytes.getData());
#elseif kha_html5
var blob = new js.html.Blob([s], {type: "application/json"});
var url = js.html.URL.createObjectURL(blob);
var a = cast(js.Browser.document.createElement("a"), js.html.AnchorElement);
a.href = url;
a.download = file;
a.click();
js.html.URL.revokeObjectURL(url);
#end
runOutput(0);
}
}