Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

fs.mkdir-shim

1.1.1 • Public • Published

fs.mkdir-shim

Build Status npm

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 >= 4.

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 Piotr Roszatycki piotr.roszatycki@gmail.com

MIT

Install

npm i fs.mkdir-shim

DownloadsWeekly Downloads

16

Version

1.1.1

License

MIT

Unpacked Size

9.29 kB

Total Files

14

Last publish

Collaborators

  • avatar