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

'node:fs/promises' does not export 'constants' #21994

Closed
JakeOShannessy opened this issue Jan 19, 2024 · 0 comments · Fixed by #21997
Closed

'node:fs/promises' does not export 'constants' #21994

JakeOShannessy opened this issue Jan 19, 2024 · 0 comments · Fixed by #21997
Labels
bug Something isn't working correctly node compat

Comments

@JakeOShannessy
Copy link

Version: Deno 1.39.4

'node:fs' exports a value 'constants'. This works in both Node and Deno as expected.

However, as of June 2022 (v18.4.0) Node also exports 'constants' from 'node:fs/promises' whereas Deno does not.

// Works in Node 18 but not Deno 1.39.4.
import { constants } from 'node:fs/promises';
console.log(constants)
// Works in both Node 18 and Deno 1.39.4.
import { constants } from 'node:fs';
console.log(constants)
@marvinhagemeister marvinhagemeister added bug Something isn't working correctly node compat labels Jan 19, 2024
marvinhagemeister added a commit that referenced this issue Jan 21, 2024
<!--
Before submitting a PR, please read https://deno.com/manual/contributing

1. Give the PR a descriptive title.

  Examples of good title:
    - fix(std/http): Fix race condition in server
    - docs(console): Update docstrings
    - feat(doc): Handle nested reexports

  Examples of bad title:
    - fix #7123
    - update docs
    - fix bugs

2. Ensure there is a related issue and it is referenced in the PR text.
3. Ensure there are tests that cover the changes.
4. Ensure `cargo test` passes.
5. Ensure `./tools/format.js` passes without changing files.
6. Ensure `./tools/lint.js` passes.
7. Open as a draft PR if your work is still in progress. The CI won't
run
   all steps, but you can add '[ci]' to a commit message to force it to.
8. If you would like to run the benchmarks on the CI, add the 'ci-bench'
label.
-->

We were missing the `constants` export in the promise `fs` API which is
available in node.

```ts
import { constants, promises } from "node:fs";
import { constants as fsPromiseConstants } from "node:fs/promises";
console.log(constants === promises.constants); // logs: true
console.log(constants === fsPromiseConstants); // logs: true
```

Fixes #21994
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly node compat
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants