Skip to content

Commit

Permalink
Declare FS encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Jun 22, 2022
1 parent f5710dd commit a17dbed
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/home.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ export async function shutdownAllServers() {
function loadState() {
try {
return JSON.parse(
fs.readFileSync(path.join(getCoreDir(), 'homestate.json'), 'utf8')
fs.readFileSync(path.join(getCoreDir(), 'homestate.json'), { encoding: 'utf-8' })
);
} catch (err) {}
}
Expand Down
2 changes: 1 addition & 1 deletion src/misc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function sleep(ms) {
export async function loadJSON(filePath) {
try {
await fs.access(filePath);
return JSON.parse(await fs.readFile(filePath, 'utf8'));
return JSON.parse(await fs.readFile(filePath, { encoding: 'utf-8' }));
} catch (err) {
console.error(err);
return null;
Expand Down
4 changes: 3 additions & 1 deletion src/project/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ export default class ProjectConfig {
this._parsed.push(path);
let section = null;
let option = null;
for (let line of (await fs.readFile(path, 'utf-8')).split(this.reLines)) {
for (let line of (await fs.readFile(path, { encoding: 'utf-8' })).split(
this.reLines
)) {
// Remove comments
line = line.replace(this.reComment, '');
if (!line) {
Expand Down

0 comments on commit a17dbed

Please sign in to comment.