MCPcopy Create free account
hub / github.com/vercel/vercel / createFile

Function createFile

packages/python-analysis/test/dist-metadata.test.ts:187–194  ·  view source on GitHub ↗

Create a file under tmpDir and return its expected RECORD entry.

(relPath: string, content: string)

Source from the content-addressed store, hash-verified

185
186 /** Create a file under tmpDir and return its expected RECORD entry. */
187 async function createFile(relPath: string, content: string): Promise<string> {
188 const fullPath = join(tmpDir, relPath);
189 await mkdir(join(fullPath, '..'), { recursive: true });
190 const buf = Buffer.from(content);
191 await writeFile(fullPath, buf);
192 const hash = createHash('sha256').update(buf).digest('base64url');
193 return `${relPath},sha256=${hash},${buf.length}`;
194 }
195
196 it('appends new entries with sha256 and size to RECORD', async () => {
197 await setupDistInfo('mypkg', '1.0.0', 'mypkg/__init__.py,,\n');

Callers 1

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected