File Methods

append

Append contents to the end of a file.

/**
 * @path           The file path to use for storage
 * @contents       The contents of the file to append
 * @metadata       Struct of metadata to store with the file
 * @throwOnMissing Boolean flag to throw if the file is missing. Otherwise it will be created if missing.
 *
 * @return LocalProvider
 *
 * @throws cbfs.FileNotFoundException
 */
function append(
	required string path,
	required contents,
	struct metadata        = {},
	boolean throwOnMissing = false
);

copy

Copy a file from one destination to another.

create

Create a file on the disk.

createFromFile

Creates a disk object directly from a file, rather than reading the file contents in to memory

upload

Uploads a file directly in to disk storage

download

Delivers a file directly to the browser

delete

Delete a file or an array of file paths. If a file does not exist, false will be returned.

exists

Validate if a file exists.

file

Returns a File Object that you can use for simpler API access.

missing

Validate if a file doesn't exist.

get

Get the contents of a file.

getAsBinary

Get the contents of a file as binary, such as an executable or image.

move

Move a file from one destination to another.

prepend

Prepend contents to the beginning of a file. This method can be a costly operation for local disk storage.

touch

Create a new empty file if it does not exist.

Last updated

Was this helpful?