Open wojtekmaj opened 7 months ago
In Node.js v10.12.0,
recursive
option was added tofs.mkdir
andfs.mkdirSync
. This option allows you to create a directory and all its parent directories if they do not exist.
mkdirp
is still WIDELY used, for no apparent reason.Each copy takes 104 kB.
The mkdirp
is already implemented in a way that the native fs.mkdir
and fs.mkdirSync
API is always preferred.
On the other hand, the mkdirp
package is now primarily used as a polyfill for Node.js version below 10.12, or as a cross-platform CLI (since cp
is not available on Windows, you can't put cp
in npm scripts).
When added as a dependency to a certain package though, it's unlikely (impossible?) for it to be used as a CLI though.
It's great that native APIs are preferred when possible. Still, 104 kB seems... excessive?
When added as a dependency to a certain package though, it's unlikely (impossible?) for it to be used as a CLI though.
It's great that native APIs are preferred when possible. Still, 104 kB seems... excessive?
But nolyfill CLI will always overwrite every copy of mkdirp
, which could also break the intended CLI usage.
Besides, the main problem is that the mkdirp
is a dual ESM/CJS package, which doubles the original size:
In Node.js v10.12.0,
recursive
option was added tofs.mkdir
andfs.mkdirSync
. This option allows you to create a directory and all its parent directories if they do not exist.mkdirp
is still WIDELY used, for no apparent reason.Each copy takes 104 kB.