ServerJS/Filesystem API/A: Difference between revisions

→‎Files: simplified open arguments
(→‎Directories: added a link to the discussion)
(→‎Files: simplified open arguments)
Line 17: Line 17:
==== Files ====
==== Files ====


; open(path (String)|options Object, [mode (String|Array|Object)], [options Object|mode (String|Array)])
; open(path String, mode|options)
: returns a stream object that supports an appropriate interface for the given options and mode, which include reading, writing, updating, byte, character, unbuffered, buffered, and line buffered streams.  More details follow in the [#Stream] section of this document.
: returns a stream object that supports an appropriate interface for the given options and mode, which include reading, writing, updating, byte, character, unbuffered, buffered, and line buffered streams.  More details follow in the [#Stream] section of this document.
* path
* path
* mode: "rwa+bxc", ["read", "write", "append", "update", "binary", "exclusive", "canonical"], {read, write, append, update, binary, exclusive, canonical}
* mode: "rwa+bxc", or
* options
* options
** path String
** mode String
** mode Object
** charset String
** charset String
** newLine String
** read Boolean
** delimiter String
** write Boolean
; read(path String|options Object, [options (Object)|mode (String|Array)])
** append Boolean
** update Boolean
** binary Boolean
** exclusive Boolean
** canonical Boolean
; read(path String, [mode|options])
: opens, reads, and closes a file, returning its content.
: opens, reads, and closes a file, returning its content.
; write(path String|options Object, content String|ByteString|ByteArray, [options (Object)|mode (String|Array)])
; write(path String, content String|Binary, [mode|options])
: opens, writes, flushes, and closes a file with the given content.  If the content is a ByteArray or ByteString, the binary mode is implied.
: opens, writes, flushes, and closes a file with the given content.  If the content is a ByteArray or ByteString, the binary mode is implied.
; copy(source String, target String)
; copy(source String, target String)
171

edits