moonbitlang/x/fs does not have a README file

    IOError

    pub(all) suberror IOError {
    IOError(String)
    } derive(
    Debug
    )

    IOError::to_repr

    #deprecated("`IOError::to_repr` is deprecated, use `@moonbitlang/core/debug.Debug::to_repr` instead.")
    fn IOError::to_repr(IOError) ->
    Repr

    create_dir

    fn create_dir(path : String) -> Unit raise IOError

    Creates a directory at the specified path. Note: nested directories are not supported for native backend

    Parameters

    • path : The path where the directory should be created.
    • mode~ : The mode of the directory. Default is 777.

    is_dir

    fn is_dir(path : String) -> Bool raise IOError

    Checks if the given path is a directory.

    Parameters

    • path : The string representing the path to be checked.

    Returns

    • Bool : true if the path is a directory, false otherwise.

    is_file

    fn is_file(path : String) -> Bool raise IOError

    Check if the given path points to a file.

    Parameters

    • path : The string representing the path to be checked.

    Returns

    • Bool : true if the path points to a file, false otherwise.

    path_exists

    fn path_exists(path : String) -> Bool

    Checks if a path exists.

    Parameters

    • path: A String representing the file path.

    Returns

    A boolean indicating whether the path exists.

    read_dir

    fn read_dir(path : String) -> ArrayView[String] raise IOError

    Reads the contents of a directory and returns a read-only view of filenames.

    Parameters

    • path : The path to the directory to be read.

    Returns

    • A view of strings representing the file names and directory names in the directory. Use to_owned() to copy the view into a mutable array.

    read_file_to_bytes

    fn read_file_to_bytes(path : String) -> Bytes raise IOError

    Reads the content of a file specified by the given path and returns its content as Bytes

    Parameters

    • path : The path to the file to be read.

    Returns

    • A Bytes representing the content of the file.

    read_file_to_string

    fn read_file_to_string(path : String, encoding? : String) -> String raise IOError

    Reads the content of a file specified by the given path and returns its content as String.

    Parameters

    • path : The path to the file to be read.
    • encoding~ : The encoding of the file. Only support utf8 for now.

    Returns

    • A String representing the content of the file.

    remove_dir

    fn remove_dir(path : String) -> Unit raise IOError

    Removes a directory at the specified path.

    Parameters

    • path : The string path to the directory that needs to be removed.

    remove_file

    fn remove_file(path : String) -> Unit raise IOError

    Removes a file at the specified path.

    Parameters

    • path : The path to the file that needs to be removed.

    write_bytes_to_file

    fn write_bytes_to_file(path : String, content : Bytes) -> Unit raise IOError

    Writes a Bytes to a file at the specified path.

    Parameters

    • path : The path to the file where the bytes will be written.
    • content : A Bytes to be written to the file.

    write_string_to_file

    fn write_string_to_file(path : String, content : String, encoding? : String) -> Unit raise IOError

    Writes a String to a file at the specified path.

    Parameters

    • path : The path to the file where the string will be written.
    • content : A String to be written to the file.
    • encoding~ : The encoding of the file. Only support utf8 for now.

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io