Provides an interface to the file system.

var FileSystem = require("FuseJS/FileSystem");

Using the asynchronous Promise based functions is recommended to keep your UI responsive, although synchronous variants are also available if preferred.

When saving files private to the application you can use the dataDirectory property as a base path.

Example

This example writes a text to a file, and then reads it back:

var FileSystem = require("FuseJS/FileSystem");
var path = FileSystem.dataDirectory + "/" + "testfile.tmp";

FileSystem.writeTextToFile(path, "hello world")
    .then(function() {
        return FileSystem.readTextFromFile(path);
    })
    .then(function(text) {
        console.log("The read file content was: " + text);
    })
    .catch(function(error) {
        console.log("Unable to read file due to error:" + error);
    });

Location

Namespace
Fuse.FileSystem
Package
Fuse.FileSystem 2.9.1
Show Uno properties and methods

Interface of FileSystemModule

Inherited from NativeModule

Inherited from Module

GetFile : FileSource uno

Returns the file source that will be watched by the Context for changes in Fuse preview. Override in subclasses and return correct file source to support live updates in Fuse preview.

Inherited from object

Attached UX Attributes

GlobalKey (attached by Resource) : string ux

The ux:Global attribute creates a global resource that is accessible everywhere in UX markup.

Implemented Interfaces