Skip to content

files

Documentation / @wtf/platform-fs / files

The files of a platform, by their paths: a path is resolved by the platform’s path against its working folder, dirs.cwd, and walked down from the root its storage gives, navigator.storage.getDirectory(), to the handle of its file or folder (handleAt), as at of ./path walks one; what a program does most with one, a file’s text read (readText) or written whole (writeText), an entry removed (removeAt), or asked for (isThere); and a pattern, the paths it matches, by glob of ./glob over the handles (globPaths, expandPaths). A failure of the handles is a PlatformError of @wtf/platform/errors, as at raises it: one of an entry not there is a SystemError of the reason NotFound (isNotFound). And a folder of the platform’s temporary folder, of a name of its own, removed after (tempFolder).

const file = await handleAt(platform, 'notes/today.md', { kind: 'file', create: true })
const writable = await file.createWritable()
await writable.write('# Today\n')
await writable.close()

Type Aliases

Functions