Skip to content

TextFileView.writeData method

TextFileView › writeData

Unofficial

Write the data to the file once the adapter is ready. On failure it restores TextFileView.lastSavedData, shows a notice and stores a backup of the unsaved text before rethrowing.

Signature:

writeData(file: TFile, data: string, previousData: string | null): Promise<void>

Parameters:

ParameterTypeDescription
fileTFileThe file to write.
datastringThe data to write.
previousDatastring | nullThe last saved data, restored if the write fails.

Returns: Promise<void> — A promise that resolves when the data is written.