mirror of https://gitee.com/bigwinds/arangodb
119 lines
2.4 KiB
Plaintext
119 lines
2.4 KiB
Plaintext
!CHAPTER Module "fs"
|
|
|
|
The implementation tries to follow the CommonJS specification where possible.
|
|
[Filesystem/A/0](http://wiki.commonjs.org/wiki/Filesystem/A/0).
|
|
|
|
!SECTION Single File Directory Manipulation
|
|
|
|
!SUBSUBSECTION exists
|
|
@startDocuBlock JS_Exists
|
|
|
|
!SUBSUBSECTION isFile
|
|
@startDocuBlock JS_IsFile
|
|
|
|
!SUBSUBSECTION isDirectory
|
|
@startDocuBlock JS_IsDirectory
|
|
|
|
!SUBSUBSECTION size
|
|
@startDocuBlock JS_Size
|
|
|
|
!SUBSUBSECTION mtime
|
|
@startDocuBlock JS_MTime
|
|
|
|
!SUBSUBSECTION pathSeparator
|
|
`fs.pathSeparator`
|
|
|
|
If you want to combine two paths you can use fs.pathSeparator instead of */* or *\\*.
|
|
|
|
!SUBSUBSECTION join
|
|
`fs.join(path, filename)`
|
|
|
|
The function returns the combination of the path and filename, e.g. fs.join(Hello/World, foo.bar) would return Hello/World/foo.bar.
|
|
|
|
!SUBSUBSECTION getTempFile
|
|
@startDocuBlock JS_GetTempFile
|
|
|
|
!SUBSUBSECTION getTempPath
|
|
@startDocuBlock JS_GetTempPath
|
|
|
|
!SUBSUBSECTION makeAbsolute
|
|
@startDocuBlock JS_MakeAbsolute
|
|
|
|
!SUBSUBSECTION chmod
|
|
@startDocuBlock JS_Chmod
|
|
|
|
!SUBSUBSECTION list
|
|
@startDocuBlock JS_List
|
|
|
|
!SUBSUBSECTION listTree
|
|
@startDocuBlock JS_ListTree
|
|
|
|
!SUBSUBSECTION makeDirectory
|
|
@startDocuBlock JS_MakeDirectory
|
|
|
|
!SUBSUBSECTION makeDirectoryRecursive
|
|
@startDocuBlock JS_MakeDirectoryRecursive
|
|
|
|
!SUBSUBSECTION remove
|
|
@startDocuBlock JS_Remove
|
|
|
|
!SUBSUBSECTION removeDirectory
|
|
@startDocuBlock JS_RemoveDirectory
|
|
|
|
!SUBSUBSECTION removeDirectoryRecursive
|
|
@startDocuBlock JS_RemoveDirectoryRecursive
|
|
|
|
!SECTION File IO
|
|
|
|
!SUBSUBSECTION read
|
|
@startDocuBlock JS_Read
|
|
|
|
!SUBSUBSECTION read64
|
|
@startDocuBlock JS_Read64
|
|
|
|
!SUBSUBSECTION readBuffer
|
|
@startDocuBlock JS_ReadBuffer
|
|
|
|
!SUBSUBSECTION readFileSync
|
|
`fs.readFileSync(filename, encoding)`
|
|
|
|
Reads the contents of the file specified in `filename`. If `encoding` is specified,
|
|
the file contents will be returned as a string. Supported encodings are:
|
|
- `utf8` or `utf-8`
|
|
- `ascii`
|
|
- `base64`
|
|
- `ucs2` or `ucs-2`
|
|
- `utf16le` or `utf16be`
|
|
- `hex`
|
|
|
|
If no `encoding` is specified, the file contents will be returned in a Buffer
|
|
object.
|
|
|
|
|
|
!SUBSUBSECTION save
|
|
@startDocuBlock JS_Save
|
|
|
|
!SUBSUBSECTION writeFileSync
|
|
`fs.writeFileSync(filename, content)`
|
|
|
|
This is an alias for `fs.write(filename, content)`.
|
|
|
|
!SECTION Recursive Manipulation
|
|
|
|
!SUBSUBSECTION copyRecursive
|
|
@startDocuBlock JS_CopyDirectoryRecursive
|
|
|
|
!SUBSUBSECTION CopyFile
|
|
@startDocuBlock JS_CopyFile
|
|
|
|
!SUBSUBSECTION move
|
|
@startDocuBlock JS_MoveFile
|
|
|
|
!SECTION ZIP
|
|
|
|
!SUBSUBSECTION unzipFile
|
|
@startDocuBlock JS_Unzip
|
|
|
|
!SUBSUBSECTION zipFile
|
|
startDocuBlock JS_Zip
|