Files
api/app/core/utils/write-to-boot.ts
Alexis 010efe75bd Revert "chore: lint all the files"
This reverts commit 4ef387b5bb.
2021-09-07 13:46:23 +09:30

16 lines
586 B
TypeScript

import fs from 'fs';
import path from 'path';
import prettyBytes from 'pretty-bytes';
import { coreLogger } from '../log';
const writeFile = async (filePath: string, fileContents: string | Buffer) => {
coreLogger.debug(`Writing ${prettyBytes(fileContents.length)} to ${filePath}`);
await fs.promises.writeFile(filePath, fileContents);
};
export const writeToBoot = async (filePath: string, fileContents: string | Buffer) => {
const basePath = '/boot/config/plugins/dynamix/';
const resolvedPath = path.resolve(basePath, filePath);
await writeFile(resolvedPath, fileContents);
};