選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

index.d.ts 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /// <reference types="node"/>
  2. import * as fs from 'fs';
  3. export interface Options {
  4. /**
  5. * Directory [permissions](https://x-team.com/blog/file-system-permissions-umask-node-js/).
  6. *
  7. * @default 0o777 & (~process.umask())
  8. */
  9. readonly mode?: number;
  10. /**
  11. * Use a custom `fs` implementation. For example [`graceful-fs`](https://github.com/isaacs/node-graceful-fs).
  12. *
  13. * 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.
  14. *
  15. * @default require('fs')
  16. */
  17. readonly fs?: typeof fs;
  18. }
  19. /**
  20. * Make a directory and its parents if needed - Think `mkdir -p`.
  21. *
  22. * @param path - Directory to create.
  23. * @returns A `Promise` for the path to the created directory.
  24. */
  25. export default function makeDir(
  26. path: string,
  27. options?: Options
  28. ): Promise<string>;
  29. /**
  30. * Synchronously make a directory and its parents if needed - Think `mkdir -p`.
  31. *
  32. * @param path - Directory to create.
  33. * @returns The path to the created directory.
  34. */
  35. export function sync(path: string, options?: Options): string;