|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.5 KB
|
| Line | |
|---|
| 1 | /// <reference types="node"/>
|
|---|
| 2 | import * as fs from 'fs';
|
|---|
| 3 |
|
|---|
| 4 | declare namespace makeDir {
|
|---|
| 5 | interface Options {
|
|---|
| 6 | /**
|
|---|
| 7 | Directory [permissions](https://x-team.com/blog/file-system-permissions-umask-node-js/).
|
|---|
| 8 |
|
|---|
| 9 | @default 0o777
|
|---|
| 10 | */
|
|---|
| 11 | readonly mode?: number;
|
|---|
| 12 |
|
|---|
| 13 | /**
|
|---|
| 14 | Use a custom `fs` implementation. For example [`graceful-fs`](https://github.com/isaacs/node-graceful-fs).
|
|---|
| 15 |
|
|---|
| 16 | Using a custom `fs` implementation will block the use of the native `recursive` option if `fs.mkdir` or `fs.mkdirSync` is not the native function.
|
|---|
| 17 |
|
|---|
| 18 | @default require('fs')
|
|---|
| 19 | */
|
|---|
| 20 | readonly fs?: typeof fs;
|
|---|
| 21 | }
|
|---|
| 22 | }
|
|---|
| 23 |
|
|---|
| 24 | declare const makeDir: {
|
|---|
| 25 | /**
|
|---|
| 26 | Make a directory and its parents if needed - Think `mkdir -p`.
|
|---|
| 27 |
|
|---|
| 28 | @param path - Directory to create.
|
|---|
| 29 | @returns The path to the created directory.
|
|---|
| 30 |
|
|---|
| 31 | @example
|
|---|
| 32 | ```
|
|---|
| 33 | import makeDir = require('make-dir');
|
|---|
| 34 |
|
|---|
| 35 | (async () => {
|
|---|
| 36 | const path = await makeDir('unicorn/rainbow/cake');
|
|---|
| 37 |
|
|---|
| 38 | console.log(path);
|
|---|
| 39 | //=> '/Users/sindresorhus/fun/unicorn/rainbow/cake'
|
|---|
| 40 |
|
|---|
| 41 | // Multiple directories:
|
|---|
| 42 | const paths = await Promise.all([
|
|---|
| 43 | makeDir('unicorn/rainbow'),
|
|---|
| 44 | makeDir('foo/bar')
|
|---|
| 45 | ]);
|
|---|
| 46 |
|
|---|
| 47 | console.log(paths);
|
|---|
| 48 | // [
|
|---|
| 49 | // '/Users/sindresorhus/fun/unicorn/rainbow',
|
|---|
| 50 | // '/Users/sindresorhus/fun/foo/bar'
|
|---|
| 51 | // ]
|
|---|
| 52 | })();
|
|---|
| 53 | ```
|
|---|
| 54 | */
|
|---|
| 55 | (path: string, options?: makeDir.Options): Promise<string>;
|
|---|
| 56 |
|
|---|
| 57 | /**
|
|---|
| 58 | Synchronously make a directory and its parents if needed - Think `mkdir -p`.
|
|---|
| 59 |
|
|---|
| 60 | @param path - Directory to create.
|
|---|
| 61 | @returns The path to the created directory.
|
|---|
| 62 | */
|
|---|
| 63 | sync(path: string, options?: makeDir.Options): string;
|
|---|
| 64 | };
|
|---|
| 65 |
|
|---|
| 66 | export = makeDir;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.