MCPcopy
hub / github.com/VSCodeVim/Vim / createFile

Function createFile

test/testUtils.ts:71–84  ·  view source on GitHub ↗
(
  args: {
    fsPath?: string;
    fileExtension?: string;
    contents?: string;
  } = {},
)

Source from the content-addressed store, hash-verified

69}
70
71export async function createFile(
72 args: {
73 fsPath?: string;
74 fileExtension?: string;
75 contents?: string;
76 } = {},
77): Promise<string> {
78 if (args.fileExtension) {
79 assert.ok(args.fileExtension.startsWith('.'));
80 }
81 args.fsPath ??= join(os.tmpdir(), rndName() + (args.fileExtension ?? ''));
82 await promisify(fs.writeFile)(args.fsPath, args.contents ?? '');
83 return args.fsPath;
84}
85
86export async function createDir(fsPath?: string): Promise<string> {
87 fsPath ??= join(os.tmpdir(), rndName());

Callers 3

tab.test.tsFile · 0.90
grep.test.tsFile · 0.90
setupWorkspaceFunction · 0.85

Calls 2

joinFunction · 0.90
rndNameFunction · 0.85

Tested by

no test coverage detected