Skip to content

appendFile

Ajoute un contenu binaire a la fin d'un fichier.

Exemple

ts
import { 
SF
} from "@duplojs/server-utils";
import {
E
} from "@duplojs/utils";
const
payload
= new
TextEncoder
().
encode
("I ❤️ DuploJS \n");
const
result
= await
SF
.
appendFile
("/tmp/file.bin",
payload
);
// result: E.Ok | SF.FileSystemLeft if (
E
.
isRight
(
result
)) {
// encoded "I ❤️ DuploJS" append with success }

Syntaxe

typescript
function appendFile(
  path: string | URL,
  data: Uint8Array
): Promise<FileSystemLeft | E.Ok>

Paramètres

  • path : chemin du fichier cible.
  • data : contenu binaire a ajouter.

Valeur de retour

  • E.Ok : si l'opération réussit.
  • FileSystemLeft : si l'opération échoue.

Voir aussi

Diffusé sous licence MIT.