Skip to content

Commit 879e10f

Browse files
authored
fix: Fix invalid and remove unnecessary string encoding arguments in asc (#1570)
1 parent 1f611c6 commit 879e10f

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

cli/asc.js

+3-10
Original file line numberDiff line numberDiff line change
@@ -945,7 +945,7 @@ exports.main = function main(argv, options, callback) {
945945
let text;
946946
stats.readCount++;
947947
stats.readTime += measure(() => {
948-
text = fs.readFileSync(name, { encoding: "utf8" });
948+
text = fs.readFileSync(name, "utf8");
949949
});
950950
return text;
951951
} catch (e) {
@@ -961,10 +961,7 @@ exports.main = function main(argv, options, callback) {
961961
filename = path.basename(filename);
962962
const outputFilePath = path.join(dirPath, filename);
963963
if (!fs.existsSync(dirPath)) mkdirp(dirPath);
964-
fs.writeFileSync(
965-
outputFilePath, contents,
966-
typeof contents === "string" ? { encoding: "utf8" } : void 0
967-
);
964+
fs.writeFileSync(outputFilePath, contents);
968965
});
969966
return true;
970967
} catch (e) {
@@ -992,11 +989,7 @@ exports.main = function main(argv, options, callback) {
992989
writeStdout.used = true;
993990
}
994991
stats.writeTime += measure(() => {
995-
if (typeof contents === "string") {
996-
stdout.write(contents, { encoding: "utf8" });
997-
} else {
998-
stdout.write(contents);
999-
}
992+
stdout.write(contents);
1000993
});
1001994
}
1002995
};

0 commit comments

Comments
 (0)