The File API Edit

The File API gives applications access to using the Multiplex file system. To get access, the "file" permission needs to be specified in the application manifest.

Usage Edit

To start using the file API, create a new file object by calling "var file = System.file(somePath);".

If you need to access functionality which requries metadata access, you need to call This method takes a callback function that is triggered when the file is properly opened. Functionality which requries this includes streaming, metadata and listDirectory.

If you do not need this functionality, you can read and write directly on the file object.

API Overview Edit

Attributes Edit

Name Type Description string Name of the file, including extension
CloudFile.path string Absolute file path
CloudFile.service string file service descriptor (Dropbox, Drive, etc)
CloudFile.localPath string file path relative to the service
CloudFile.isDir boolean Does the file describe a directory
CloudFile.url string Virtual Url to reference data from this CloudFile. This attribute only exists if getUrl was called.

Methods Edit

Function Parameters Returns Description
  1. String path
  2. String path relative
CloudFile Object Creates a CloudFile Object
  1. function Callback(success)
- Opens this CloudFile, and grabs all necessary metadata
CloudFile.close - - Closes the CloudFile Object and releases the held resources
  1. function Callback(data)
- Reads data from the file system
  1. uint8Array data
  2. function Callback(success)
- Writes data to the file system
  1. function Callback(success)
- Makes sure the file exists
  1. function Callback(exists)
- Checks if this file exists
  1. function Callback(success)
Delete the CloudFile
  1. number chunkSize
  2. function onChunk(data)
  3. function onStreamEnded
Future: Stream Control Object Establishes a chunked streaming session
CloudFile.getMetadata - Object
CloudFile.listDirectory - Array CloudFile Object List all files in this directory.
CloudFile.getFileType - string Gets the file extension.
CloudFile.getMime - string Gets the mime
CloudFile.getParent - CloudFile Object Gets the CloudFiles parent CloudFile.
  1. function Callback(zipdata)
uint8Array - - Download this CloudFile Object to the clients computer.
CloudFile.upload - - Request a file from the clients computer to be upload to this CloudFile Object
  1. function Callback(url)
- Creates a virtual Url to reference data from this CloudFile, useful when working with older libraries.
CloudFile.supportedOperations - Object Returns a object specifying supported operations. Read/Write etc.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.