MCPcopy Create free account
hub / github.com/denoland/std / create

Function create

fs/unstable_create.ts:25–35  ·  view source on GitHub ↗
(path: string | URL)

Source from the content-addressed store, hash-verified

23 * @returns A promise that resolves to a {@linkcode FsFile} instance.
24 */
25export async function create(path: string | URL): Promise<FsFile> {
26 if (isDeno) {
27 return Deno.create(path);
28 } else {
29 try {
30 return await open(path, { create: true, write: true, truncate: true });
31 } catch (error) {
32 throw mapError(error);
33 }
34 }
35}
36
37/**
38 * Creates a file if none exists or truncates an existing file and returns

Callers 1

Calls 2

openFunction · 0.90
mapErrorFunction · 0.90

Tested by

no test coverage detected