1
0
Fork 0
arangodb/Documentation/Books/Users/ModuleFs
Jan Steemann c946a1536a documentation for fs 2014-10-15 14:01:15 +02:00
..
README.mdpp documentation for fs 2014-10-15 14:01:15 +02:00

README.mdpp

!CHAPTER Module "fs"

!SUBSECTION File System Module

The implementation follows the CommonJS specification 
[Filesystem/A/0](http://wiki.commonjs.org/wiki/Filesystem/A/0).


<!-- lib/V8/v8-utils.cpp  -->

@startDocuBlock JS_Exists


<!-- lib/V8/v8-utils.cpp  -->

@startDocuBlock JS_GetTempFile


<!-- lib/V8/v8-utils.cpp  -->

@startDocuBlock JS_GetTempPath


<!-- lib/V8/v8-utils.cpp  -->

@startDocuBlock JS_IsDirectory


<!-- lib/V8/v8-utils.cpp  -->

@startDocuBlock JS_IsFile


`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.


<!-- lib/V8/v8-utils.cpp  -->

@startDocuBlock JS_List


<!-- lib/V8/v8-utils.cpp  -->

@startDocuBlock JS_ListTree


<!-- lib/V8/v8-utils.cpp  -->

@startDocuBlock JS_MakeDirectory


<!-- lib/V8/v8-utils.cpp  -->

@startDocuBlock JS_Move


`fs.pathSeparator`

If you want to combine two paths you can use fs.pathSeparator instead of */* or *\\*.


<!-- lib/V8/v8-utils.cpp  -->

@startDocuBlock JS_Read


<!-- lib/V8/v8-utils.cpp  -->

@startDocuBlock JS_Read64


<!-- lib/V8/v8-utils.cpp  -->

@startDocuBlock JS_ReadBuffer


`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.


<!-- lib/V8/v8-utils.cpp  -->

@startDocuBlock JS_Remove


<!-- lib/V8/v8-utils.cpp  -->

@startDocuBlock JS_RemoveDirectory


<!-- lib/V8/v8-utils.cpp  -->

@startDocuBlock JS_Size


<!-- lib/V8/v8-utils.cpp  -->

@startDocuBlock JS_Save


<!-- lib/V8-v8-utils.cpp  -->

`fs.writeFileSync(filename, content)`

This is an alias for `fs.write(filename, content)`.