@nomicfoundation/hardhat-keystore
Version:
A module for managing keystore files that store a map from IDs to encrypted string values.
16 lines • 661 B
JavaScript
import { exists, writeJsonFile, readJsonFile, move, } from "@nomicfoundation/hardhat-utils/fs";
export class FileManagerImpl {
fileExists(absolutePath) {
return exists(absolutePath);
}
async writeJsonFile(absolutePathToFile, keystoreFile) {
// First write to a temporary file, then move it to minimize the risk of file corruption
const tmpPath = `${absolutePathToFile}.tmp`;
await writeJsonFile(tmpPath, keystoreFile);
return await move(tmpPath, absolutePathToFile);
}
readJsonFile(absolutePathToFile) {
return readJsonFile(absolutePathToFile);
}
}
//# sourceMappingURL=file-manager.js.map