MCPcopy
hub / github.com/garrytan/gstack / appendSecureFile

Function appendSecureFile

browse/src/file-permissions.ts:133–140  ·  view source on GitHub ↗
(
  filePath: string,
  data: string | NodeJS.ArrayBufferView,
)

Source from the content-addressed store, hash-verified

131 * (no need to re-run icacls on every log line).
132 */
133export function appendSecureFile(
134 filePath: string,
135 data: string | NodeJS.ArrayBufferView,
136): void {
137 const existed = fs.existsSync(filePath);
138 fs.appendFileSync(filePath, data, { mode: 0o600 });
139 if (!existed) restrictFilePermissions(filePath);
140}
141
142/**
143 * `mkdir -p` with owner-only directory permissions, cross-platform.

Callers 2

logAttemptFunction · 0.90

Calls 1

restrictFilePermissionsFunction · 0.85

Tested by

no test coverage detected