vibe.core.file

File handling functions and types.

Members

Enums

DirectoryChangeType
enum DirectoryChangeType

Specifies the kind of change in a watched directory.

FileMode
enum FileMode

Specifies how a file is manipulated on disk.

Functions

appendToFile
void appendToFile(NativePath path, string data)
void appendToFile(string path, string data)

Convenience function to append to a file.

copyFile
void copyFile(NativePath from, NativePath to, bool overwrite)
void copyFile(string from, string to)

Copies a file.

createDirectory
void createDirectory(NativePath path)
void createDirectory(string path, Flag!"recursive" recursive)

Creates a new directory.

createTempFile
FileStream createTempFile(string suffix)

Creates and opens a temporary file for writing.

existsFile
bool existsFile(NativePath path)
bool existsFile(string path)

Checks if a file exists

getFileInfo
FileInfo getFileInfo(NativePath path)
FileInfo getFileInfo(string path)

Stores information about the specified file/directory into 'info'

getWorkingDirectory
NativePath getWorkingDirectory()

Returns the current working directory.

iterateDirectory
int delegate(scope int delegate(ref FileInfo)) iterateDirectory(NativePath path)
int delegate(scope int delegate(ref FileInfo)) iterateDirectory(string path)

Enumerates all files in the specified directory.

listDirectory
void listDirectory(NativePath path, bool delegate(FileInfo info) @(safe) del)
void listDirectory(string path, bool delegate(FileInfo info) @(safe) del)
void listDirectory(NativePath path, bool delegate(FileInfo info) @(system) del)
void listDirectory(string path, bool delegate(FileInfo info) @(system) del)

Enumerates all files in the specified directory.

moveFile
void moveFile(NativePath from, NativePath to, bool copy_fallback)
void moveFile(string from, string to, bool copy_fallback)

Moves or renames a file.

openFile
FileStream openFile(NativePath path, FileMode mode)
FileStream openFile(string path, FileMode mode)

Opens a file stream with the specified mode.

readFile
ubyte[] readFile(NativePath path, ubyte[] buffer, size_t max_size)
ubyte[] readFile(string path, ubyte[] buffer, size_t max_size)

Read a whole file into a buffer.

readFileUTF8
string readFileUTF8(NativePath path)
string readFileUTF8(string path)

Read a whole UTF-8 encoded file into a string.

removeFile
void removeFile(NativePath path)
void removeFile(string path)

Removes a file

watchDirectory
DirectoryWatcher watchDirectory(NativePath path, bool recursive)

Starts watching a directory for changes.

watchDirectory
DirectoryWatcher watchDirectory(string path, bool recursive)
Undocumented in source. Be warned that the author may not have intended to support it.
writeFile
void writeFile(NativePath path, ubyte[] contents)
void writeFile(string path, ubyte[] contents)

Write a whole file at once.

writeFileUTF8
void writeFileUTF8(NativePath path, string contents)

Write a string into a UTF-8 encoded file.

Mixins

__anonymous
mixin validateRandomAccessStream!FileStream
Undocumented in source.

Structs

DirectoryChange
struct DirectoryChange

Describes a single change in a watched directory.

DirectoryWatcher
struct DirectoryWatcher

Interface for directory watcher implementations.

FileInfo
struct FileInfo

Contains general information about a file.

FileStream
struct FileStream

Accesses the contents of a file as a stream.

Meta

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.

Authors

Sönke Ludwig