3 ms·
Node 10 has fs, at least: require("fs").promises.readdir(".").then(console.log)
by tlrobinson 8y ago
Node 10 has fs, at least:
require("fs").promises.readdir(".").then(console.log)
- jonny_eh 8y agoWhy not just: require("fs").readdir(".").then(console.log)
- tlrobinson 8y agoThat's the legacy callback version. In practice you'd probably do: const fs = require("fs").promises; // ... fs.readdir(".").then(console.log);
- kjeetgill 8y agoAh, thats pretty nice. The previous example was pretty janky but I didn't foresee it being used like this. Eyes opened.
- salehenrahman 8y agoIt can potentially break things. There are legacy code that assume that calling `readdir` will yield undefined, and will have just passed that result to a function, that alters its behaviour based on whether a parameter is undefined.
- jonny_eh 8y agoInteresting. Seems like a great opportunity for a major version bump.