appendFile
Appends binary content to the end of a file.
Example
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
}Syntax
typescript
function appendFile(
path: string | URL,
data: Uint8Array
): Promise<FileSystemLeft | E.Ok>Parameters
path: target file path.data: binary content to append.
Return value
E.Ok: if the operation succeeds.FileSystemLeft: if the operation fails.
See also
appendTextFile- Appends text content.
