Skip to content

fs: export constants from `fs/promises`

Rodrigo Muino Tomonari requested to merge github/fork/F3n67u/fs-constants into master

This pr re-export constants from fs/promises

Motivation

see https://github.com/nodejs/node/issues/43140#issuecomment-1130087002

constants is only export from fs, but not export from fs/promises.

When writing code that uses the promise based fs library via fs/promises, if fs constants is used, we have to add another import module which is not convenient:

import fs from 'fs/promise';
import { constants } from 'fs';

If we re-export constants from fs/promises, then we could reduce two import to one:

import fs, { constants } from 'fs/promises';

Merge request reports

Loading