Frida Docs Unified
    Preparing search index...

    Provides basic filesystem access.

    Index

    Constructors

    • Opens or creates the file at filePath with mode specifying how it should be opened. For example "wb" to open the file for writing in binary mode. This is the same format as fopen() from the C standard library.

      Parameters

      • filePath: string

        Path to file to open or create.

      • mode: string

        Mode to use.

      Returns File

    Properties

    SEEK_CUR: number

    Passed to seek() to specify that the offset is relative to the current file position.

    SEEK_END: number

    Passed to seek() to specify that the offset is relative to the end of the file.

    SEEK_SET: number

    Passed to seek() to specify that the offset is relative to the start of the file.

    Methods

    • Closes the file. You should call this function when you’re done with the file unless you are fine with this happening when the object is garbage-collected or the script is unloaded.

      Returns void

    • Flushes any buffered data to the underlying file.

      Returns void

    • Opens the binary file at filePath, reads all of its content into an ArrayBuffer, and then closes the file.

      Parameters

      • filePath: string

        The file to read from.

      Returns ArrayBuffer

    • Opens the UTF-8 encoded text file at filePath, reads all of its text into a string, and then closes the file.

      Parameters

      • filePath: string

        The file to read from.

      Returns string

    • Reads up to n bytes from the file, or the rest of the file if unspecified. Returns an empty buffer when the end of the file is reached.

      Parameters

      • Optionaln: number

        The maximum number of bytes to read.

      Returns ArrayBuffer

    • Reads one line of text from the file, with the newline included. Returns an empty string when the end of the file is reached.

      Ensures that the data is valid UTF-8 and throws an error otherwise.

      Returns string

    • Reads up to n bytes from the file into a string. If n is omitted, the rest of the file is read. Returns an empty string when the end of the file is reached.

      Ensures that the data is valid UTF-8 and throws an error otherwise.

      Parameters

      • Optionaln: number

        The maximum number of bytes to read.

      Returns string

    • Changes the current file position to the specified offset, in bytes. Returns the resulting offset.

      Parameters

      • offset: number

        The byte offset to seek to.

      • Optionalwhence: number

        What the offset is relative to (default: File.SEEK_SET).

      Returns number

    • Returns the current file position, in bytes.

      Returns number

    • Synchronously writes data to the file.

      Parameters

      Returns void

    • Creates a new file at filePath, writes the specified bytes to it, and then closes the file. The target file is overwritten in case it already exists.

      Parameters

      • filePath: string

        The file to write to.

      • bytes: ArrayBuffer | number[]

        The bytes to write to the file.

      Returns void

    • Creates a new file at filePath, writes the specified text to it encoded as UTF-8, and then closes the file. The target file is overwritten in case it already exists.

      Parameters

      • filePath: string

        The file to write to.

      • text: string

        The string to write to the file.

      Returns void