Skip to content

Commit

Permalink
Replace write-file-atomic with atomically (#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
fregante authored Jul 13, 2024
1 parent d0168aa commit d1b5dbc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import path from 'path';
import os from 'os';
import fs from 'graceful-fs';
import {xdgConfig} from 'xdg-basedir';
import writeFileAtomic from 'write-file-atomic';
import {writeFileSync} from 'atomically';
import dotProp from 'dot-prop';
import uniqueString from 'unique-string';

Expand Down Expand Up @@ -43,7 +43,7 @@ export default class Configstore {

// Empty the file if it encounters invalid JSON
if (error.name === 'SyntaxError') {
writeFileAtomic.sync(this._path, '', writeFileOptions);
writeFileSync(this._path, '', writeFileOptions);
return {};
}

Expand All @@ -56,7 +56,7 @@ export default class Configstore {
// Make sure the folder exists as it could have been deleted in the meantime
fs.mkdirSync(path.dirname(this._path), mkdirOptions);

writeFileAtomic.sync(this._path, JSON.stringify(value, undefined, '\t'), writeFileOptions);
writeFileSync(this._path, JSON.stringify(value, undefined, '\t'), writeFileOptions);
} catch (error) {
// Improve the message of permission errors
if (error.code === 'EACCES') {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
"save"
],
"dependencies": {
"atomically": "^2.0.3",
"dot-prop": "^6.0.1",
"graceful-fs": "^4.2.6",
"unique-string": "^3.0.0",
"write-file-atomic": "^3.0.3",
"xdg-basedir": "^5.0.1"
},
"devDependencies": {
Expand Down

0 comments on commit d1b5dbc

Please sign in to comment.