vibe.core.file

File handling functions and types.

Public Imports

vibe.core.stream
public import vibe.core.stream;
Undocumented in source.

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(Path path, string data)
void appendToFile(string path, string data)

Convenience function to append to a file.

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

Copies a file.

createDirectory
void createDirectory(Path path)
void createDirectory(string path)

Creates a new directory.

createTempFile
FileStream createTempFile(string suffix)

Creates and opens a temporary file for writing.

existsFile
bool existsFile(Path path)
bool existsFile(string path)

Checks if a file exists

getFileInfo
FileInfo getFileInfo(Path path)
FileInfo getFileInfo(string path)

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

getWorkingDirectory
Path getWorkingDirectory()

Returns the current working directory.

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

Enumerates all files in the specified directory.

listDirectory
void listDirectory(Path path, bool delegate(FileInfo info) del)
void listDirectory(string path, bool delegate(FileInfo info) del)

Enumerates all files in the specified directory.

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

Moves or renames a file.

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

Opens a file stream with the specified mode.

readFile
ubyte[] readFile(Path 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(Path path)
string readFileUTF8(string path)

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

removeFile
void removeFile(Path path)
void removeFile(string path)

Removes a file

watchDirectory
DirectoryWatcher watchDirectory(Path 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(Path path, ubyte[] contents)
void writeFile(string path, ubyte[] contents)

Write a whole file at once.

writeFileUTF8
void writeFileUTF8(Path path, string contents)

Write a string into a UTF-8 encoded file.

Interfaces

DirectoryWatcher
interface DirectoryWatcher

Interface for directory watcher implementations.

FileStream
interface FileStream

Accesses the contents of a file as a stream.

Structs

DirectoryChange
struct DirectoryChange

Describes a single change in a watched directory.

FileInfo
struct FileInfo

Contains general information about a file.

Meta

License

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

Authors

Sönke Ludwig