appendTextFile
Ajoute un contenu texte a la fin d'un fichier.
Exemple
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
}Syntaxe
typescript
function appendTextFile(
path: string | URL,
data: string
): Promise<FileSystemLeft | E.Ok>Paramètres
path: chemin du fichier cible.data: contenu texte a ajouter.
Valeur de retour
E.Ok: si l'opération réussit.FileSystemLeft: si l'opération échoue.
Voir aussi
appendFile- Ajoute un contenu binaire.
