MCPcopy Index your code
hub / github.com/electron/asar / compFiles

Function compFiles

test/util/compareFiles.ts:4–27  ·  view source on GitHub ↗
(actualFilePath: string, expectedFilePath: string)

Source from the content-addressed store, hash-verified

2import { wrappedFs as fs } from '../../src/wrapped-fs.js';
3
4export async function compFiles(actualFilePath: string, expectedFilePath: string): Promise<void> {
5 if (process.env.ELECTRON_ASAR_SPEC_UPDATE) {
6 await fs.writeFile(expectedFilePath, await fs.readFile(actualFilePath));
7 }
8 const [actualFileContent, expectedFileContent] = await Promise.all([
9 fs.readFile(actualFilePath, 'utf8'),
10 fs.readFile(expectedFilePath, 'utf8'),
11 ]);
12 expect(actualFileContent).toBe(expectedFileContent);
13
14 const [actualIsSymlink, expectedIsSymlink] = [
15 isSymbolicLinkSync(actualFilePath),
16 isSymbolicLinkSync(expectedFilePath),
17 ];
18 expect(actualIsSymlink).toBe(expectedIsSymlink);
19
20 if (actualIsSymlink && expectedIsSymlink) {
21 const [actualSymlinkPointer, expectedSymlinkPointer] = [
22 fs.readlinkSync(actualFilePath),
23 fs.readlinkSync(expectedFilePath),
24 ];
25 expect(actualSymlinkPointer).toBe(expectedSymlinkPointer);
26 }
27}
28
29export function isSymbolicLinkSync(path: string): boolean {
30 const stats = fs.lstatSync(path);

Callers 2

api-spec.tsFile · 0.85
cli-spec.tsFile · 0.85

Calls 1

isSymbolicLinkSyncFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…