Introduction
Most apps keep a few files of their own: settings, saved data, a cache, recent files and logs. Each operating system has a place for each of these, and the places differ from macOS to Windows to Linux. KScript.Storage finds the right one for you. You name the kind of folder, and your script reads and writes files in it without building any paths.
To get started, import the package and ask for a folder with @storage():
<import package="KScript.Storage" />
<let name="settings" value="@storage(config)->read_json('settings.json', default: { theme: 'light' })" />
<do>$settings.theme = 'dark'</do>
<do>@storage(config)->write_json('settings.json', $settings)</do>import KScript.Storage
$settings = @storage(config)->read_json('settings.json', default: { theme: 'light' })
$settings.theme = 'dark'
@storage(config)->write_json('settings.json', $settings)samples/storage is a small notes app that keeps its notes, a counter and the person's own settings this way.