buffer[1] += 2;
fs.writeSync(fd, buffer, 0, 16, 4);
fs.closeSync(fd);
+
+ fs.mkdirSync('a/b/c', {recursive: true});
+ await fs.promises.mkdir('d/e/f', {recursive: false});
+
+ fs.rmdirSync('a/b/c', {recursive: true});
+ await fs.promises.rmdir('d/e/f', {recursive: false});
}
function qs_module(str: NjsByteString) {
*
* @since 0.4.2
* @param path A path to a file.
- * @param options The file mode (or an object specifying the file mode). Defaults to `0o777`.
+ * @param options A number specifying file mode, defaults to `0o777`.
+ * @param options An object with the following optional keys:
+ * - `mode` - A number specifying file mode, defaults to `0o777`.
+ * - `recursive` - If true, perform a recursive directory creation, defaults to `false`.
*/
- mkdir(path: PathLike, options?: { mode?: number } | number): Promise<void>;
+ mkdir(path: PathLike, options?: { mode?: number; recursive?: boolean; } | number): Promise<void>;
/**
* Asynchronously reads the contents of a directory at the specified `path`.
*
* @since 0.4.2
* @param path A path to a file.
+ * @param options An object with the following optional keys:
+ * - `recursive` - If true, perform a recursive directory removal, defaults to `false`.
*/
- rmdir(path: PathLike): Promise<void>;
+ rmdir(path: PathLike, options?: { recursive?: boolean; }): Promise<void>;
/**
* Asynchronously retrieves `fs.Stats` object for the specified `path`.
*
* @since 0.4.2
* @param path A path to a file.
- * @param options The file mode (or an object specifying the file mode). Defaults to `0o777`.
+ * @param options A number specifying file mode. defaults to `0o777`.
+ * @param options An object with the following optional keys:
+ * - `mode` - A number specifying file mode, defaults to `0o777`.
+ * - `recursive` - If true, perform a recursive directory creation, defaults to `false`.
*/
- mkdirSync(path: PathLike, options?: { mode?: number } | number): void;
+ mkdirSync(path: PathLike, options?: { mode?: number; recursive?: boolean; } | number): void;
/**
* Synchronously opens a file specified in the `path`.
*
* @since 0.4.2
* @param path A path to a file.
+ * @param options An object with the following optional keys:
+ * - `recursive` - If true, perform a recursive directory removal, defaults to `false`.
*/
- rmdirSync(path: PathLike): void;
+ rmdirSync(path: PathLike, options?: { recursive?: boolean; }): void;
/**
* Synchronously retrieves `fs.Stats` object for the specified path.