Skip to content

FileManager.createNewFile method

FileManager › createNewFile

Unofficial

Create a new file in the vault at specified location.

Signature:

createNewFile(location?: TFolder, filename?: string, extension?: string, contents?: string): Promise<TFile>

Parameters:

ParameterTypeDescription
location?TFolderLocation to create the file in, defaults to root.
filename?stringName of the file to create, defaults to 'Untitled' (incremented if file already exists).
extension?stringExtension of the file to create, defaults to 'md'.
contents?stringContents of the file to create, defaults to empty string.

Returns: Promise<TFile> — A promise that resolves to the newly created file.