Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export fs/promises function for esm like you do for cjs #1008

Closed
FreePhoenix888 opened this issue Jun 30, 2023 · 1 comment
Closed

Export fs/promises function for esm like you do for cjs #1008

FreePhoenix888 opened this issue Jun 30, 2023 · 1 comment

Comments

@FreePhoenix888
Copy link

  • Operating System:
  • Ubuntu 22.04
  • Node.js version:
  • Node.js v18.14.0
  • fs-extra version:
  • fs-extra@11.1.1

Export fs/promises function for esm like you do for cjs

@RyanZim
Copy link
Collaborator

RyanZim commented Jun 30, 2023

In CJS mode, we're exporting wrapped versions of graceful-fs which support either callbacks or promises. We can't do this in ESM, since exports are static. See #746 for detailed discussion.

We could export * from 'fs/promises', but that wouldn't cover native sync methods, which would be confusing, because you'd have to import native sync methods from fs, but fs-extra/esm exports both sync and async methods. Also, this would be inconsistent with the CJS version, since the CJS version exports graceful-fs, not fs.

@RyanZim RyanZim closed this as completed Nov 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants