fs.mkdir-shim
v2.0.0
Published
Polyfill/shim for fs.mkdir in node versions < v10.12
Downloads
363
Readme
fs.mkdir-shim
Polyfill for fs.mkdir in node versions < v10.12
node v10.12.0 added support for a recursive option for fs.mkdir
:
https://github.com/nodejs/node/pull/21875
This package provides the built-in fs.mkdir
in node v10.12.0 and later,
and a replacement in other environments.
The replacement uses make-dir
module.
Requirements
This module requires Node >= 6.
This package implements the es-shim API interface. It works in an ES6-supported environment and complies with the spec.
Installation
npm install fs.mkdir-shim
Additionally for Typescript:
npm install -D @types/node
Usage
Direct
const mkdir = require('fs.mkdir-shim');
// Use `mkdir` just like the built-in method on `fs`
Typescript:
import mkdir from 'fs.mkdir-shim';
// Use `mkdir` just like the built-in method on `fs`
Shim
require('fs.mkdir-shim/shim')();
// `fs.mkdir` is now defined
const fs = require('fs');
// Use `fs.mkdir`
or:
require('fs.mkdir-shim/auto');
// `fs.mkdir` is now defined
const fs = require('fs');
// Use `fs.mkdir`
Typescript:
import mkdirShim from 'fs.mkdir-shim/shim';
mkdirShim();
// `fs.mkdir` is now defined
import fs from 'fs';
// Use `fs.mkdir`
or:
import 'fs.mkdir-shim/auto';
// `fs.mkdir` is now defined
import fs from 'fs';
// Use `fs.mkdir`
License
Copyright (c) 2018-2020 Piotr Roszatycki [email protected]