mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2025-12-30 03:03:06 -05:00
22 lines
431 B
TypeScript
22 lines
431 B
TypeScript
import { writeFile } from 'fs/promises';
|
|
import { join } from 'path';
|
|
import { CHALLENGE_DIR } from '../configs/paths';
|
|
|
|
export const saveStep = async (
|
|
sup: string,
|
|
block: string,
|
|
step: string,
|
|
content: string
|
|
): Promise<boolean> => {
|
|
try {
|
|
const filePath = join(CHALLENGE_DIR, block, step);
|
|
|
|
await writeFile(filePath, content);
|
|
|
|
return true;
|
|
} catch (err) {
|
|
console.log(err);
|
|
return false;
|
|
}
|
|
};
|