# HG changeset patch # User Yaroslav Zhuravlev # Date 1594128387 -3600 # Node ID 428a8cf1911b1f5f85f69a3d6c1705f966c998e7 # Parent 55da8df41bfd0e5362dfc75407031a0417b4409b Documented mkdirSync, readdirSync, rmdirSync, fs.Dirent in njs. diff --git a/xml/en/docs/njs/reference.xml b/xml/en/docs/njs/reference.xml --- a/xml/en/docs/njs/reference.xml +++ b/xml/en/docs/njs/reference.xml @@ -9,7 +9,7 @@
+ rev="44">
@@ -1335,6 +1335,52 @@ by default is a +mkdirSync(path[, +options]) + +Synchronously creates a directory at the specified path +(0.4.2). +The options parameter is expected to be an +integer that specifies +the mode, +or an object with the following keys: + + +mode + +mode option, by default is 0o777. + + + + + +readdirSync(path[, +options]) + +Synchronously reads the contents of a directory +at the specified path +(0.4.2). +The options parameter is expected to be +a string that specifies encoding +or an object with the following keys: + + +encoding + +encoding, by default is not specified. +The encoding can be utf8. + + +withFileTypes + +if set to true, the files array will contain +fs.Dirent objects, +by default is false. + + + + + readFileSync(filename[, options]) @@ -1397,6 +1443,12 @@ undefined +rmdirSync(path) + +Synchronously removes a directory at the specified path +(0.4.2). + + symlinkSync(target, path) @@ -1448,6 +1500,73 @@ undefined +
+ + +fs.Dirent is a representation of a directory entry— +a file or a subdirectory. +When +readdirSync() +is called with the +withFileTypes +option, +the resulting array contains fs.Dirent objects. + + + + +dirent.isBlockDevice()—returns +true if the fs.Dirent object describes +a block device. + + + +dirent.isCharacterDevice()—returns +true if the fs.Dirent object describes +a character device. + + + +dirent.isDirectory()—returns +true if the fs.Dirent object describes +a file system directory. + + + +dirent.isFIFO()—returns +true if the fs.Dirent object describes +a first-in-first-out (FIFO) pipe. + + + +dirent.isFile()—returns +true if the fs.Dirent object describes +a regular file. + + + +dirent.isSocket()—returns +true if the fs.Dirent object describes +a socket. + + + +dirent.isSymbolicLink()—returns +true if the fs.Dirent object describes +a symbolic link. + + + +dirent.name— +the name of the file fs.Dirent object refers to. + + + + + +
+ +