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