Skip to content

FileSystem Mixin

dbradberry edited this page Feb 5, 2013 · 1 revision

The FileSystem Mixin provides access to the Android device’s underlying file system.

By allowing your Module to inherit from common.FileSystem you gain the following methods@

  • cacheDir()
    Returns the path of the directory used by the Agent to store cache files.
  • deleteFile(source)
    Deletes the file source from the Agent’s file system.
  • downloadFile(source, destination, block_size=65536)
    Downloads the file source (on the Agent) to destination, on your local machine.
  • exists(source)
    True, if the file source exists on the Agent’s file system.
  • fileSize(source)
    Returns the size of the file source (on the Agent) in bytes.
  • format_file_size(size)
    Returns a human-readable representation of size bytes in B, KiB, MiB or GiB.
  • isDirectory(target)
    True, if the file target exists on the Agent’s file system and is a directory.
  • isFile(target)
    True, if the file target exists on the Agent’s file system and is a regular file.
  • listFiles(target)
    Returns a list of all files in the target directory, on the Agent’s file system.
  • md5sum(source)
    Returns the MD5 checksum of source on the Agent’s file system (requires the ClassLoader mixin).
  • readFile(source, block_size=65536)
    Returns the contents of the file source on the Agent’s file system.
  • uploadFile(source, destination, block_size=65536)
    Upload a file source (from your local machine) as destination on the Agent’s file system.
  • writeFile(destination, data, block_size=65536)
    Write data into a file destination on the Agent’s file system.
Clone this wiki locally