UNPKG

@kadena/kadena-cli

Version:

Kadena CLI tool to interact with the Kadena blockchain (manage keys, transactions, etc.)

26 lines 902 B
import path from 'path'; import { services } from '../../../../services/index.js'; export async function createDir(directory) { await services.filesystem.ensureDirectoryExists(directory); } export async function createLogFile(folder, filename) { const exampleData = { timestamp: 0, from: '', to: '', amount: 0, requestKey: '', action: undefined, }; const directory = path.join(`${folder}/`); await createDir(directory); const filepath = path.join(directory, filename); const headers = `${Object.keys(exampleData).join(',')}\n`; await services.filesystem.writeFile(filepath, headers); return filepath; } export async function appendToLogFile(filepath, data) { const dataString = Object.values(data).join(','); await services.filesystem.appendFile(filepath, `${dataString}\n`); } //# sourceMappingURL=file.js.map