mirror of
https://github.com/Dictionarry-Hub/profilarr.git
synced 2026-02-01 15:20:49 +01:00
29 lines
653 B
TypeScript
29 lines
653 B
TypeScript
/**
|
|
* PCD README Handler
|
|
* Handles reading and writing README.md files for PCD repositories
|
|
*/
|
|
|
|
import { logger } from '$logger/logger.ts';
|
|
|
|
/**
|
|
* Read README from a PCD repository
|
|
*/
|
|
export async function readReadme(pcdPath: string): Promise<string | null> {
|
|
try {
|
|
return await Deno.readTextFile(`${pcdPath}/README.md`);
|
|
} catch {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Write README to a PCD repository
|
|
*/
|
|
export async function writeReadme(pcdPath: string, content: string): Promise<void> {
|
|
await Deno.writeTextFile(`${pcdPath}/README.md`, content);
|
|
await logger.info('Wrote README', {
|
|
source: 'PCDReadme',
|
|
meta: { path: pcdPath, content }
|
|
});
|
|
}
|