create

import { create } from "jsr:@ende/fs/unstable-create";

function · experimental · requires --allow-read, --allow-write

async function create(path: string | URL): Promise<FsFile>

Creates a file if none exists or truncates an existing file and resolves to an instance of FsFile.

Requires allow-read and allow-write permissions.

path: string | URL

The path to the newly created file.

Returns

A promise that resolves to a FsFile instance.

Example: Usage

import { create } from "@ende/fs/unstable-create";
const file = await create("/foo/bar.txt");

Source