@types/mkdirp

  • Version 1.0.2
  • Published
  • 6.63 kB
  • 1 dependency
  • MIT license

Install

npm i @types/mkdirp
yarn add @types/mkdirp
pnpm add @types/mkdirp

Overview

TypeScript definitions for mkdirp

Index

Functions

function manual

manual: (dir: string, opts?: Mode | Options) => Promise<string | undefined>;
  • Use the manual implementation (not the native one). This is the default when the native implementation is not available or the stat/mkdir implementation is overridden.

function manualSync

manualSync: (dir: string, opts?: Mode | OptionsSync) => string | undefined;
  • Use the manual implementation (not the native one). This is the default when the native implementation is not available or the stat/mkdir implementation is overridden.

function mkdirp

mkdirp: typeof mkdirp;
  • Create a new directory and any necessary subdirectories at dir with octal permission string opts.mode. If opts is a string or number, it will be treated as the opts.mode. If opts.mode isn't specified, it defaults to 0o777 & (~process.umask()).

    Promise resolves to first directory made that had to be created, or undefined if everything already exists. Promise rejects if any errors are encountered. Note that, in the case of promise rejection, some directories may have been created, as recursive directory creation is not an atomic operation. You can optionally pass in an alternate fs implementation by passing in opts.fs.

    Your implementation should have opts.fs.mkdir(path, opts, cb) and opts.fs.stat(path, cb).

    You can also override just one or the other of mkdir and stat by passing in opts.stat or opts.mkdir, or providing an fs option that only overrides one of these.

function native

native: (dir: string, opts?: Mode | Options) => Promise<string | undefined>;
  • Use the native implementation (not the manual one). This is the default when the native implementation is available and stat/mkdir are not overridden.

function nativeSync

nativeSync: (dir: string, opts?: Mode | OptionsSync) => string | undefined;
  • Use the native implementation (not the manual one). This is the default when the native implementation is available and stat/mkdir are not overridden.

function sync

sync: (dir: string, opts?: Mode | OptionsSync) => string | undefined;
  • Synchronously create a new directory and any necessary subdirectories at dir with octal permission string opts.mode. If opts is a string or number, it will be treated as the opts.mode. If opts.mode isn't specified, it defaults to 0o777 & (~process.umask()). You can optionally pass in an alternate fs implementation by passing in opts.fs. Your implementation should have opts.fs.mkdirSync(path, mode) and opts.fs.statSync(path). You can also override just one or the other of mkdirSync and statSync by passing in opts.statSync or opts.mkdirSync, or providing an fs option that only overrides one of these.

    Returns

    Returns the first directory that had to be created, or undefined if everything already exists.

Interfaces

interface FsImplementation

interface FsImplementation {}

    property mkdir

    mkdir: typeof fs.mkdir;

      property stat

      stat: typeof fs.stat;

        interface FsImplementationSync

        interface FsImplementationSync {}

          property mkdirSync

          mkdirSync: typeof fs.mkdirSync;

            property statSync

            statSync: typeof fs.statSync;

              interface Options

              interface Options {}

                property fs

                fs?: FsImplementation | undefined;

                  property mode

                  mode?: Mode | undefined;

                    interface OptionsSync

                    interface OptionsSync {}

                      property fs

                      fs?: FsImplementationSync | undefined;

                        property mode

                        mode?: Mode | undefined;

                          Type Aliases

                          type Mode

                          type Mode = number | string | undefined;

                            Package Files (1)

                            Dependencies (1)

                            Dev Dependencies (0)

                            No dev dependencies.

                            Peer Dependencies (0)

                            No peer dependencies.

                            Badge

                            To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                            You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/mkdirp.

                            • Markdown
                              [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/mkdirp)
                            • HTML
                              <a href="https://www.jsdocs.io/package/@types/mkdirp"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>