Skip to content

DataAdapter.process method

DataAdapter › process

Official

Atomically read, modify, and save the contents of a plaintext file.

Signature:

process(normalizedPath: string, fn: (data: string) => string, options?: DataWriteOptions | undefined): Promise<string>

Parameters:

Parameter Type Description
normalizedPath string path to file/folder, use {@link normalizePath} to normalize beforehand.
fn (data: string) => string a callback function which returns the new content of the file synchronously.
options? DataWriteOptions | undefined write options.

Returns: Promise<string>string - the text value of the file that was written.