logging options

This commit is contained in:
Bryan Clark 2019-12-05 00:41:50 -05:00
parent bfbec53132
commit 12896dfb0f
2 changed files with 2 additions and 2 deletions

BIN
dist/index.js generated vendored

Binary file not shown.

View file

@ -46,9 +46,9 @@ export function generate(id: string, username: string, password: string) {
async function write(directory: string, settings: string) {
const options = {encoding: 'utf-8', flag: 'wx'}; // 'wx': Like 'w' but fails if path exists
const location = path.join(directory, SETTINGS_FILE);
console.log(`writing ${location}`);
console.log(`writing ${location} with options ${options}`);
try {
return fs.writeFileSync(location, settings, options);
fs.writeFileSync(location, settings, options);
} catch (e) {
if (e.code == fs.constants.O_EXCL) {
console.log(`overwriting existing file ${location}`);