File Class
Warning: Macros that reference
File are blocked on macro sharing. Remove File.* calls or replace them with built-in macro storage flows before sharing.
File gives scripts basic file-system access inside the app environment.File.read(path)
Read a file as text.
let path = File.getFilesDir() + '/macro-log.txt';
File.write(path, 'ready');
console.log(File.read(path));File.write(path, content)
Write text to a file.
let path = File.getFilesDir() + '/macro-log.txt';
File.write(path, 'run=1\nstate=ready');
console.log(File.read(path));File.append(path, content)
Append text to a file.
let path = File.getFilesDir() + '/macro-log.txt';
File.write(path, 'run=1');
File.append(path, '\nrun=2');
console.log(File.read(path));File.exists(path)
Check whether a path exists.
let path = File.getFilesDir() + '/macro-log.txt';
File.write(path, 'ready');
console.log(File.exists(path));File.delete(path)
Delete a file.
let path = File.getFilesDir() + '/macro-log.txt';
File.write(path, 'ready');
File.delete(path);
console.log(File.exists(path));File.list(directory)
List entries in a directory.
console.log(File.list(File.getFilesDir()));File.mkdir(path)
Create a directory.
let path = File.getFilesDir() + '/exports';
File.mkdir(path);
console.log(File.exists(path));File.size(path)
Read file size.
let path = File.getFilesDir() + '/macro-log.txt';
File.write(path, 'ready');
console.log(File.size(path));File.isDirectory(path)
Type checks.
console.log(File.isDirectory(File.getFilesDir()));File.isFile(path)
Type checks.
let path = File.getFilesDir() + '/macro-log.txt';
File.write(path, 'ready');
console.log(File.isFile(path));File.getExternalFilesDir()
Useful app storage roots.
console.log(File.getExternalFilesDir());File.getFilesDir()
Useful app storage roots.
console.log(File.getFilesDir());