Node-fs-extra: Node.js 10

Created on 6 Feb 2018  路  10Comments  路  Source: jprichardson/node-fs-extra

Node.js 10 isn't out yet, but I just wanted to post this here so we're aware: https://twitter.com/jasnell/status/960733696461438976

It seems that fs.promise.readFile() etc. will have native promise support. I don't see a lot needing changed on our end, other than exposing this API when it's available.

Can close this when all the maintainers have seen this.

Most helpful comment

I have gotten clarity from the Node.js core team, and unflagged ESM (ES6 modules) support will _not_ be landing in Node 10.0.0, though there's a possibility it'll land later on the 10.x line. So we don't need to worry about that for now.

All 10 comments

Got it!

According to https://github.com/nodejs/Release; Node 10 is slated for release in April, which is also the time for the EOL of Node 4 LTS. I'm thinking we should probably cut one major release containing 10 support and dropping 4 support.

fs.promise has been moved to fs/promise, so you'd do require('fs/promise') to get the promise API. (See https://github.com/nodejs/node/pull/18777 for the change.) The purpose of this is to be better prepared for ESM.

Now, the question on our end is this: do we have to also support require('fs-extra/promise')? I'm not sure.

  • Could argue yes, we're a drop-in replacement for fs.
  • Could argue no, we support promises already in normal fs-extra, there's no need for fs/promise here.

@jprichardson @manidlou @JPeer264 Thoughts?

I would argue yes, as this library should be a drop-in replacement for fs.

Also in the readme we kinda promise: You don't ever need to include the original fs module again. So if we do not support require(fs-extra/promise) then the previous argument seems a bit falsy.

@JPeer264 Understood; the counterpoint is that we already have promise support, so you'll never need to use fs/promise.

Hm that's true. After lot of thinking now I think it might be better to keep it as is, but we should mention somewhere that require(fs-extra/promise) is not needed.

yeah.. no need to add it!

I have gotten clarity from the Node.js core team, and unflagged ESM (ES6 modules) support will _not_ be landing in Node 10.0.0, though there's a possibility it'll land later on the 10.x line. So we don't need to worry about that for now.

When using fs-extra on Node.js 10.1.0, an ExperimentalWarning is printed to console - see https://github.com/jprichardson/node-fs-extra/issues/577

Closing since this is no longer needed.

Was this page helpful?
0 / 5 - 0 ratings