-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
Closed as not planned
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.stale
Description
What is the problem this feature will solve?
The JSON.parse(fs.readFileSync(path)), fs.readFile(path, "utf-8", res => { res = JSON.parse(res); /* ... */ }) look just way too long and complex.
What is the feature you are proposing to solve the problem?
The "json" encoding for the builtin fs module. Here's how it might look like:
const users = fs.readFileSync("users.json", "json"); // Or { "encoding": "json" }As you can see, it's much shorter and more clear.
What alternatives have you considered?
As I've shown above, JSON.parse is a variant right now, but it's just way too long. There's also r-json package, but having a separate package just for reading JSON files takes much more space.
Metadata
Metadata
Assignees
Labels
feature requestIssues that request new features to be added to Node.js.Issues that request new features to be added to Node.js.fsIssues and PRs related to the fs subsystem / file system.Issues and PRs related to the fs subsystem / file system.stale