appendTextFile
Appends text content to the end of a file.
Example
ts
import { SF } from "@duplojs/server-utils";
import { E } from "@duplojs/utils";
const result = await SF.appendTextFile("/tmp/file.txt", "I ❤️ DuploJS \n");
// result: E.Ok | SF.FileSystemLeft
if (E.isRight(result)) {
// "I ❤️ DuploJS" append with success
}Syntax
typescript
function appendTextFile(
path: string | URL,
data: string
): Promise<FileSystemLeft | E.Ok>Parameters
path: target file path.data: text content to append.
Return value
E.Ok: if the operation succeeds.FileSystemLeft: if the operation fails.
See also
appendFile- Appends binary content.
