Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dex4er/js-fs.mkdir-shim
Polyfill for fs.mkdir in node versions < v10.12
https://github.com/dex4er/js-fs.mkdir-shim
hacktoberfest
Last synced: about 2 months ago
JSON representation
Polyfill for fs.mkdir in node versions < v10.12
- Host: GitHub
- URL: https://github.com/dex4er/js-fs.mkdir-shim
- Owner: dex4er
- License: mit
- Created: 2018-10-17T19:17:51.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-05-27T22:37:17.000Z (7 months ago)
- Last Synced: 2024-05-28T08:13:54.912Z (7 months ago)
- Topics: hacktoberfest
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/fs.mkdir-shim
- Size: 36.1 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# fs.mkdir-shim
[![Build Status](https://secure.travis-ci.org/dex4er/js-fs.mkdir-shim.svg)](http://travis-ci.org/dex4er/js-fs.mkdir-shim) [![npm](https://img.shields.io/npm/v/fs.mkdir-shim.svg)](https://www.npmjs.com/package/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`:
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`](https://www.npmjs.com/package/make-dir)
module.## Requirements
This module requires Node >= 6.
This package implements the [es-shim API](https://github.com/es-shims/api)
interface. It works in an ES6-supported environment and complies with the
[spec](http://www.ecma-international.org/ecma-262/6.0/).## Installation
```shell
npm install fs.mkdir-shim
```_Additionally for Typescript:_
```shell
npm install -D @types/node
```## Usage
### Direct
```js
const mkdir = require('fs.mkdir-shim');
// Use `mkdir` just like the built-in method on `fs`
```_Typescript:_
```ts
import mkdir from 'fs.mkdir-shim';
// Use `mkdir` just like the built-in method on `fs`
```### Shim
```js
require('fs.mkdir-shim/shim')();
// `fs.mkdir` is now defined
const fs = require('fs');
// Use `fs.mkdir`
```or:
```js
require('fs.mkdir-shim/auto');
// `fs.mkdir` is now defined
const fs = require('fs');
// Use `fs.mkdir`
```_Typescript:_
```js
import mkdirShim from 'fs.mkdir-shim/shim';
mkdirShim();
// `fs.mkdir` is now defined
import fs from 'fs';
// Use `fs.mkdir`
```or:
```js
import 'fs.mkdir-shim/auto';
// `fs.mkdir` is now defined
import fs from 'fs';
// Use `fs.mkdir`
```## License
Copyright (c) 2018-2020 Piotr Roszatycki
[MIT](https://opensource.org/licenses/MIT)