MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / makeStats

Function makeStats

packages/kaos/test/ssh.test.ts:749–770  ·  view source on GitHub ↗
(node: TreeNode)

Source from the content-addressed store, hash-verified

747 }
748
749 function makeStats(node: TreeNode): unknown {
750 const isDir = node.type === 'dir';
751 // Either include type bits (0o040000/0o100000) or strip them to force
752 // the buildStMode helper to derive them via isDirectory()/isFile().
753 const baseMode = isDir ? 0o040755 : 0o100644;
754 const mode = node.stripTypeBits === true ? baseMode & 0o7777 : baseMode;
755 return {
756 mode,
757 size: node.content ? node.content.length : 0,
758 uid: 1000,
759 gid: 1000,
760 atime: 100,
761 mtime: 200,
762 isDirectory: () => isDir,
763 isFile: () => !isDir,
764 isSymbolicLink: () => false,
765 isSocket: () => false,
766 isCharacterDevice: () => false,
767 isBlockDevice: () => false,
768 isFIFO: () => false,
769 };
770 }
771
772 function lookup(root: TreeNode, path: string): TreeNode | undefined {
773 if (path === '/') return root;

Callers 3

statFunction · 0.70
lstatFunction · 0.70
readdirFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected