Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f3a6bab

Browse filesBrowse files
committed
Use utf8 for readFile
1 parent f876ba9 commit f3a6bab
Copy full SHA for f3a6bab

File tree

Expand file treeCollapse file tree

2 files changed

+2
-2
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+2
-2
lines changed

‎JavaScript/2-callback-use.js

Copy file name to clipboardExpand all lines: JavaScript/2-callback-use.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const fs = require('fs');
44

5-
fs.readFile('./1-callback.js', (err, data) => {
5+
fs.readFile('./1-callback.js', 'utf8', (err, data) => {
66
console.log({ lines: data.toString().split('\n').length });
77
});
88

‎JavaScript/3-callback-named.js

Copy file name to clipboardExpand all lines: JavaScript/3-callback-named.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ const print = (err, data) => {
88

99
const fileName = './1-callback.js';
1010

11-
fs.readFile(fileName, print);
11+
fs.readFile(fileName, 'utf8', print);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.