Frida Gum
    Preparing search index...

    Class File

    Provides basic filesystem access.

    Index
    • 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

    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.

    • 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

    • 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

    • 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

    • 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: number[] | ArrayBuffer

        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