Difference between revisions of "File Module"

From BaseX Documentation
Jump to navigation Jump to search
m (Text replacement - "ub-director" to "ubdirector")
 
(15 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
This [[Module Library|XQuery Module]] contains functions related to file system operations, such as listing, reading, or writing files.
 
This [[Module Library|XQuery Module]] contains functions related to file system operations, such as listing, reading, or writing files.
  
This module is based on the [http://expath.org/spec/file EXPath File Module].
+
This module is based on the [http://expath.org/spec/file EXPath File Module]. The following enhancements have not been added to the specification yet:
 +
 
 +
{| class="wikitable"
 +
|- valign="top"
 +
! Function
 +
! Description
 +
|- valign="top"
 +
| {{Function||file:descendants}}
 +
| new function
 +
|- valign="top"
 +
| {{Function||file:is-absolute}}
 +
| new function
 +
|- valign="top"
 +
| {{Function||file:read-text}}, {{Function||file:read-text-lines}}
 +
| <code>$fallback</code> argument added
 +
|- valign="top"
 +
| {{Function||file:read-text-lines}}
 +
| <code>$offset</code> and <code>$length</code> arguments added
 +
|- valign="top"
 +
| {{Function||file:resolve-path}}
 +
| <code>$base</code> argument added
 +
|}
  
 
=Conventions=
 
=Conventions=
Line 13: Line 34:
 
==File Paths==
 
==File Paths==
  
* All file paths are resolved against the ''current working directory'' (the directory from which BaseX or, more generally, the Java Virtual Machine, was started). This directory can be retrieved via [[#file:base-dir|file:base-dir]].
+
* All file paths are resolved against the ''current working directory'' (the directory from which BaseX or, more generally, the Java Virtual Machine, was started). This directory can be retrieved via {{Function||file:base-dir}}.
  
 
* A path can be specified as local filesystem path or as file URI.
 
* A path can be specified as local filesystem path or as file URI.
Line 22: Line 43:
  
 
==file:list==
 
==file:list==
 +
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:list|$dir as xs:string|xs:string*}}<br />{{Func|file:list|$dir as xs:string, $recursive as xs:boolean|xs:string*}}<br />{{Func|file:list|$dir as xs:string, $recursive as xs:boolean, $pattern as xs:string|xs:string*}}<br />
 
|{{Func|file:list|$dir as xs:string|xs:string*}}<br />{{Func|file:list|$dir as xs:string, $recursive as xs:boolean|xs:string*}}<br />{{Func|file:list|$dir as xs:string, $recursive as xs:boolean, $pattern as xs:string|xs:string*}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
|Lists all files and directories found in the specified {{Code|$dir}}. The returned paths are relative to the provided path.<br />The optional parameter {{Code|$recursive}} specifies whether sub-directories will be traversed, too.<br />The optional parameter {{Code|$pattern}} defines a file name pattern in the [[Commands#Glob_Syntax|Glob Syntax]]. If present, only those files and directories are returned that correspond to the pattern. Several patterns can be separated with a comma ({{Code|,}}).<br />
+
|Lists all files and directories found in the specified {{Code|$dir}}. The returned paths are relative to the provided path.<br />The optional parameter {{Code|$recursive}} specifies whether subdirectories will be traversed, too.<br />The optional parameter {{Code|$pattern}} defines a file name pattern in the [[Commands#Glob_Syntax|Glob Syntax]]. If present, only those files and directories are returned that correspond to the pattern. Several patterns can be separated with a comma ({{Code|,}}).<br />
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|not-found|#Errors}} the specified file does not exist.<br />{{Error|no-dir|#Errors}} the specified path does not point to a directory.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
 
|{{Error|not-found|#Errors}} the specified file does not exist.<br />{{Error|no-dir|#Errors}} the specified path does not point to a directory.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
Line 37: Line 59:
  
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:children|$dir as xs:string|xs:string*}}
 
|{{Func|file:children|$dir as xs:string|xs:string*}}
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
|Returns the full paths to all files and directories found in the specified {{Code|$dir}}.<br/>The inverse function is [[#file:parent|file:parent]]. The related function [[#file:list|file:list]] returns relative file paths.
+
|Returns the full paths to all files and directories found in the specified {{Code|$dir}}.<br/>The inverse function is {{Function||file:parent}}. The related function {{Function||file:list}} returns relative file paths.
|-
+
|- valign="top"
 +
| '''Errors'''
 +
|{{Error|not-found|#Errors}} the specified file does not exist.<br />{{Error|no-dir|#Errors}} the specified path does not point to a directory.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
 +
|}
 +
 
 +
==file:descendants==
 +
 
 +
{| width='100%'
 +
|- valign="top"
 +
| width='120' | '''Signatures'''
 +
|{{Func|file:descendants|$dir as xs:string|xs:string*}}
 +
|- valign="top"
 +
| '''Summary'''
 +
|Returns the full paths to all files and directories found in the specified {{Code|$dir}} and its subdirectories.<br/>. The related function {{Function||file:list}} returns relative file paths.
 +
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|not-found|#Errors}} the specified file does not exist.<br />{{Error|no-dir|#Errors}} the specified path does not point to a directory.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
 
|{{Error|not-found|#Errors}} the specified file does not exist.<br />{{Error|no-dir|#Errors}} the specified path does not point to a directory.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
Line 51: Line 87:
  
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:read-binary|$path as xs:string|xs:base64Binary}}<br />{{Func|file:read-binary|$path as xs:string, $offset as xs:integer|xs:base64Binary}}<br />{{Func|file:read-binary|$path as xs:string, $offset as xs:integer, $length as xs:integer|xs:base64Binary}}
 
|{{Func|file:read-binary|$path as xs:string|xs:base64Binary}}<br />{{Func|file:read-binary|$path as xs:string, $offset as xs:integer|xs:base64Binary}}<br />{{Func|file:read-binary|$path as xs:string, $offset as xs:integer, $length as xs:integer|xs:base64Binary}}
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Reads the binary content of the file specified by {{Code|$path}} and returns it as [[Lazy Module|lazy]] {{Code|xs:base64Binary}} item.<br />The optional parameters {{Code|$offset}} and {{Code|$length}} can be used to read chunks of a file.
 
|Reads the binary content of the file specified by {{Code|$path}} and returns it as [[Lazy Module|lazy]] {{Code|xs:base64Binary}} item.<br />The optional parameters {{Code|$offset}} and {{Code|$length}} can be used to read chunks of a file.
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|not-found|#Errors}} the specified file does not exist.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|out-of-range|#Errors}} the offset or length is negative, or the chosen values would exceed the file bounds.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
 
|{{Error|not-found|#Errors}} the specified file does not exist.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|out-of-range|#Errors}} the offset or length is negative, or the chosen values would exceed the file bounds.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
|-
+
|- valign="top"
 
| '''Examples'''
 
| '''Examples'''
 
|
 
|
Line 69: Line 105:
  
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:read-text|$path as xs:string|xs:string}}<br />{{Func|file:read-text|$path as xs:string, $encoding as xs:string|xs:string}}<br />{{Func|file:read-text|$path as xs:string, $encoding as xs:string, $fallback as xs:boolean|xs:string}}<br />
 
|{{Func|file:read-text|$path as xs:string|xs:string}}<br />{{Func|file:read-text|$path as xs:string, $encoding as xs:string|xs:string}}<br />{{Func|file:read-text|$path as xs:string, $encoding as xs:string, $fallback as xs:boolean|xs:string}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Reads the textual contents of the file specified by {{Code|$path}} and returns it as [[Lazy Module|lazy]] {{Code|xs:string}} item:
 
|Reads the textual contents of the file specified by {{Code|$path}} and returns it as [[Lazy Module|lazy]] {{Code|xs:string}} item:
 
* The UTF-8 default encoding can be overwritten with the optional {{Code|$encoding}} argument.
 
* The UTF-8 default encoding can be overwritten with the optional {{Code|$encoding}} argument.
 
* By default, invalid characters will be rejected. If {{Code|$fallback}} is set to true, these characters will be replaced with the Unicode replacement character <code>FFFD</code> (&#xFFFD;).
 
* By default, invalid characters will be rejected. If {{Code|$fallback}} is set to true, these characters will be replaced with the Unicode replacement character <code>FFFD</code> (&#xFFFD;).
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|not-found|#Errors}} the specified file does not exist.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|unknown-encoding|#Errors}} the specified encoding is not supported, or unknown.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.
 
|{{Error|not-found|#Errors}} the specified file does not exist.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|unknown-encoding|#Errors}} the specified encoding is not supported, or unknown.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.
|-
+
|- valign="top"
 
| '''Examples'''
 
| '''Examples'''
 
|
 
|
Line 89: Line 125:
  
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
|{{Func|file:read-text-lines|$path as xs:string|xs:string}}<br />{{Func|file:read-text-lines|$path as xs:string, $encoding as xs:string|xs:string*}}<br />{{Func|file:read-text-lines|$path as xs:string, $encoding as xs:string, $fallback as xs:boolean|xs:string*}}<br />{{Func|file:read-text-lines|$path as xs:string, $encoding as xs:string, $fallback as xs:boolean, $offset as xs:integer|xs:string*}}<br />{{Func|file:read-text-lines|$path as xs:string, $encoding as xs:string, $fallback as xs:boolean, $offset as xs:integer, $length as xs:integer|xs:string*}}<br />
+
|{{Func|file:read-text-lines|$path as xs:string|xs:string*}}<br />{{Func|file:read-text-lines|$path as xs:string, $encoding as xs:string|xs:string*}}<br />{{Func|file:read-text-lines|$path as xs:string, $encoding as xs:string, $fallback as xs:boolean|xs:string*}}<br />{{Func|file:read-text-lines|$path as xs:string, $encoding as xs:string, $fallback as xs:boolean, $offset as xs:integer|xs:string*}}<br />{{Func|file:read-text-lines|$path as xs:string, $encoding as xs:string, $fallback as xs:boolean, $offset as xs:integer, $length as xs:integer|xs:string*}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Reads the textual contents of the file specified by {{Code|$path}} and returns it as a sequence of {{Code|xs:string}} items:
 
|Reads the textual contents of the file specified by {{Code|$path}} and returns it as a sequence of {{Code|xs:string}} items:
Line 98: Line 134:
 
* By default, invalid characters will be rejected. If {{Code|$fallback}} is set to true, these characters will be replaced with the Unicode replacement character <code>FFFD</code> (&#xFFFD;).
 
* By default, invalid characters will be rejected. If {{Code|$fallback}} is set to true, these characters will be replaced with the Unicode replacement character <code>FFFD</code> (&#xFFFD;).
 
The lines to be read can be restricted with the optional parameters {{Code|$offset}} and {{Code|$length}}.
 
The lines to be read can be restricted with the optional parameters {{Code|$offset}} and {{Code|$length}}.
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|not-found|#Errors}} the specified file does not exist.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|unknown-encoding|#Errors}} the specified encoding is not supported, or unknown.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
 
|{{Error|not-found|#Errors}} the specified file does not exist.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|unknown-encoding|#Errors}} the specified encoding is not supported, or unknown.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
Line 108: Line 144:
  
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:create-dir|$dir as xs:string|empty-sequence()}}<br />
 
|{{Func|file:create-dir|$dir as xs:string|empty-sequence()}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Creates the directory specified by {{Code|$dir}} if it does not already exist. Non-existing parent directories will be created as well.<br />
 
|Creates the directory specified by {{Code|$dir}} if it does not already exist. Non-existing parent directories will be created as well.<br />
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|exists|#Errors}} the specified target exists, but is no directory.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
 
|{{Error|exists|#Errors}} the specified target exists, but is no directory.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
Line 122: Line 158:
  
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:create-temp-dir|$prefix as xs:string, $suffix as xs:string|xs:string}}<br />{{Func|file:create-temp-dir|$prefix as xs:string, $suffix as xs:string, $dir as xs:string|xs:string}}
 
|{{Func|file:create-temp-dir|$prefix as xs:string, $suffix as xs:string|xs:string}}<br />{{Func|file:create-temp-dir|$prefix as xs:string, $suffix as xs:string, $dir as xs:string|xs:string}}
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Creates a new temporary directory that did not exist before this function was called, and returns its full file path. The directory name begins and ends with the specified {{Code|$prefix}} and {{Code|$suffix}}. If no directory is specified via {{Code|$dir}}, the directory will be placed in the system’s default temporary directory. The operation will create all non-existing parent directories.
 
|Creates a new temporary directory that did not exist before this function was called, and returns its full file path. The directory name begins and ends with the specified {{Code|$prefix}} and {{Code|$suffix}}. If no directory is specified via {{Code|$dir}}, the directory will be placed in the system’s default temporary directory. The operation will create all non-existing parent directories.
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|no-dir|#Errors}} the specified directory points to a file.<br />{{Error|io-error|#Errors}} the directory could not be created.
 
|{{Error|no-dir|#Errors}} the specified directory points to a file.<br />{{Error|io-error|#Errors}} the directory could not be created.
Line 136: Line 172:
  
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:create-temp-file|$prefix as xs:string, $suffix as xs:string|xs:string}}<br />{{Func|file:create-temp-file|$prefix as xs:string, $suffix as xs:string, $dir as xs:string|xs:string}}
 
|{{Func|file:create-temp-file|$prefix as xs:string, $suffix as xs:string|xs:string}}<br />{{Func|file:create-temp-file|$prefix as xs:string, $suffix as xs:string, $dir as xs:string|xs:string}}
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Creates a new temporary file that did not exist before this function was called, and returns its full file path. The file name begins and ends with the specified {{Code|$prefix}} and {{Code|$suffix}}. If no directory is specified via {{Code|$dir}}, the file will be placed in the system’s default temporary directory. The operation will create all non-existing parent directories.
 
|Creates a new temporary file that did not exist before this function was called, and returns its full file path. The file name begins and ends with the specified {{Code|$prefix}} and {{Code|$suffix}}. If no directory is specified via {{Code|$dir}}, the file will be placed in the system’s default temporary directory. The operation will create all non-existing parent directories.
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|no-dir|#Errors}} the specified directory points to a file.<br />{{Error|io-error|#Errors}} the directory could not be created.
 
|{{Error|no-dir|#Errors}} the specified directory points to a file.<br />{{Error|io-error|#Errors}} the directory could not be created.
Line 148: Line 184:
  
 
==file:delete==
 
==file:delete==
 +
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:delete|$path as xs:string|empty-sequence()}}<br />{{Func|file:delete|$path as xs:string, $recursive as xs:boolean|empty-sequence()}}<br />
 
|{{Func|file:delete|$path as xs:string|empty-sequence()}}<br />{{Func|file:delete|$path as xs:string, $recursive as xs:boolean|empty-sequence()}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
|Recursively deletes a file or directory specified by {{Code|$path}}.<br />The optional parameter {{Code|$recursive}} specifies whether sub-directories will be deleted, too.<br />
+
|Recursively deletes a file or directory specified by {{Code|$path}}.<br />The optional parameter {{Code|$recursive}} specifies whether subdirectories will be deleted, too.<br />
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|not-found|#Errors}} the specified path does not exist.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
 
|{{Error|not-found|#Errors}} the specified path does not exist.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
Line 161: Line 198:
  
 
==file:write==
 
==file:write==
 +
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:write|$path as xs:string, $items as item()*|empty-sequence()}}<br />{{Func|file:write|$path as xs:string, $items as item()*, $params as item()|empty-sequence()}}<br />
 
|{{Func|file:write|$path as xs:string, $items as item()*|empty-sequence()}}<br />{{Func|file:write|$path as xs:string, $items as item()*, $params as item()|empty-sequence()}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
|Writes a serialized sequence of items to the specified file. If the file already exists, it will be overwritten.<br />The {{Code|$params}} argument contains serialization parameters (see [[Serialization]] for more details), which can either be specified<br />
+
|Writes a serialized sequence of items to the specified file. If the file already exists, it will be overwritten.<br />The {{Code|$params}} argument contains [[Serialization|serialization parameters]]. As with [https://www.w3.org/TR/xpath-functions-31/#func-serialize fn:serialize()], the parameters can be specified<br />
* as children of an {{Code|&lt;output:serialization-parameters/&gt;}} element, as defined for the [http://www.w3.org/TR/xpath-functions-30/#func-serialize fn:serialize()] function; e.g.:
+
* either as children of an {{Code|&lt;output:serialization-parameters/&gt;}} element:
<pre class="brush:xml">
+
<syntaxhighlight lang="xml">
 
<output:serialization-parameters>
 
<output:serialization-parameters>
 
   <output:method value='xml'/>
 
   <output:method value='xml'/>
Line 175: Line 213:
 
   ...
 
   ...
 
</output:serialization-parameters>
 
</output:serialization-parameters>
</pre>
+
</syntaxhighlight>
* as map, which contains all key/value pairs:
+
* or as map, which contains all key/value pairs:
<pre class="brush:xml">
+
<syntaxhighlight lang="xquery">
 
map { "method": "xml", "cdata-section-elements": "div", ... }
 
map { "method": "xml", "cdata-section-elements": "div", ... }
</pre>
+
</syntaxhighlight>
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|no-dir|#Errors}} the parent of specified path is no directory.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
 
|{{Error|no-dir|#Errors}} the parent of specified path is no directory.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
|-
+
|- valign="top"
 
| '''Examples'''
 
| '''Examples'''
 
|
 
|
Line 193: Line 231:
  
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:write-binary|$path as xs:string, $value as xs:anyAtomicType|empty-sequence()}}<br />{{Func|file:write-binary|$path as xs:string, $value as xs:anyAtomicType, $offset as xs:integer|empty-sequence()}}<br />
 
|{{Func|file:write-binary|$path as xs:string, $value as xs:anyAtomicType|empty-sequence()}}<br />{{Func|file:write-binary|$path as xs:string, $value as xs:anyAtomicType, $offset as xs:integer|empty-sequence()}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Writes a binary item (xs:base64Binary, xs:hexBinary) to the specified file. If the file already exists, it will be overwritten.<br />If {{Code|$offset}} is specified, data will be written at this file position. An existing file may be resized by that operation.
 
|Writes a binary item (xs:base64Binary, xs:hexBinary) to the specified file. If the file already exists, it will be overwritten.<br />If {{Code|$offset}} is specified, data will be written at this file position. An existing file may be resized by that operation.
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|no-dir|#Errors}} the parent of specified path is no directory.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|out-of-range|#Errors}} the offset is negative, or it exceeds the current file size.<br/>{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
 
|{{Error|no-dir|#Errors}} the parent of specified path is no directory.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|out-of-range|#Errors}} the offset is negative, or it exceeds the current file size.<br/>{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
Line 207: Line 245:
  
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:write-text|$path as xs:string, $value as xs:string|empty-sequence()}}<br />{{Func|file:write-text|$path as xs:string, $value as xs:string, $encoding as xs:string|empty-sequence()}}<br />
 
|{{Func|file:write-text|$path as xs:string, $value as xs:string|empty-sequence()}}<br />{{Func|file:write-text|$path as xs:string, $value as xs:string, $encoding as xs:string|empty-sequence()}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Writes a string to the specified file. If the file already exists, it will be overwritten.<br />The optional parameter {{Code|$encoding}} defines the output encoding (default: UTF-8).<br />
 
|Writes a string to the specified file. If the file already exists, it will be overwritten.<br />The optional parameter {{Code|$encoding}} defines the output encoding (default: UTF-8).<br />
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|no-dir|#Errors}} the parent of specified path is no directory.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|unknown-encoding|#Errors}} the specified encoding is not supported, or unknown.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
 
|{{Error|no-dir|#Errors}} the parent of specified path is no directory.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|unknown-encoding|#Errors}} the specified encoding is not supported, or unknown.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
Line 221: Line 259:
  
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:write-text-lines|$path as xs:string, $values as xs:string*|empty-sequence()}}<br />{{Func|file:write-text-lines|$path as xs:string, $values as xs:string*, $encoding as xs:string|empty-sequence()}}<br />
 
|{{Func|file:write-text-lines|$path as xs:string, $values as xs:string*|empty-sequence()}}<br />{{Func|file:write-text-lines|$path as xs:string, $values as xs:string*, $encoding as xs:string|empty-sequence()}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Writes a sequence of strings to the specified file, each followed by the system specific newline character. If the file already exists, it will be overwritten.<br />The optional parameter {{Code|$encoding}} defines the output encoding (default: UTF-8).<br />
 
|Writes a sequence of strings to the specified file, each followed by the system specific newline character. If the file already exists, it will be overwritten.<br />The optional parameter {{Code|$encoding}} defines the output encoding (default: UTF-8).<br />
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|no-dir|#Errors}} the parent of specified path is no directory.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|unknown-encoding|#Errors}} the specified encoding is not supported, or unknown.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
 
|{{Error|no-dir|#Errors}} the parent of specified path is no directory.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|unknown-encoding|#Errors}} the specified encoding is not supported, or unknown.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
Line 233: Line 271:
  
 
==file:append==
 
==file:append==
 +
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:append|$path as xs:string, $items as item()*|empty-sequence()}}<br />{{Func|file:append|$path as xs:string, $items as item()*, $params as item()|empty-sequence()}}<br />
 
|{{Func|file:append|$path as xs:string, $items as item()*|empty-sequence()}}<br />{{Func|file:append|$path as xs:string, $items as item()*, $params as item()|empty-sequence()}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Appends a serialized sequence of items to the specified file. If the file does not exists, a new file is created.<br />
 
|Appends a serialized sequence of items to the specified file. If the file does not exists, a new file is created.<br />
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|no-dir|#Errors}} the parent of specified path is no directory.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
 
|{{Error|no-dir|#Errors}} the parent of specified path is no directory.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
Line 248: Line 287:
  
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:append-binary|$path as xs:string, $value as xs:anyAtomicType|empty-sequence()}}<br />
 
|{{Func|file:append-binary|$path as xs:string, $value as xs:anyAtomicType|empty-sequence()}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Appends a binary item (xs:base64Binary, xs:hexBinary) to the specified file. If the file does not exists, a new one is created.<br />
 
|Appends a binary item (xs:base64Binary, xs:hexBinary) to the specified file. If the file does not exists, a new one is created.<br />
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|no-dir|#Errors}} the parent of specified path is no directory.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
 
|{{Error|no-dir|#Errors}} the parent of specified path is no directory.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
Line 262: Line 301:
  
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:append-text|$path as xs:string, $value as xs:string|empty-sequence()}}<br />{{Func|file:append-text|$path as xs:string, $value as xs:string, $encoding as xs:string|empty-sequence()}}<br />
 
|{{Func|file:append-text|$path as xs:string, $value as xs:string|empty-sequence()}}<br />{{Func|file:append-text|$path as xs:string, $value as xs:string, $encoding as xs:string|empty-sequence()}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Appends a string to a file specified by {{Code|$path}}. If the specified file does not exists, a new file is created.<br />The optional parameter {{Code|$encoding}} defines the output encoding (default: UTF-8).<br />
 
|Appends a string to a file specified by {{Code|$path}}. If the specified file does not exists, a new file is created.<br />The optional parameter {{Code|$encoding}} defines the output encoding (default: UTF-8).<br />
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|no-dir|#Errors}} the parent of specified path is no directory.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|unknown-encoding|#Errors}} the specified encoding is not supported, or unknown.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
 
|{{Error|no-dir|#Errors}} the parent of specified path is no directory.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|unknown-encoding|#Errors}} the specified encoding is not supported, or unknown.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
Line 276: Line 315:
  
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:append-text-lines|$path as xs:string, $values as xs:string*|empty-sequence()}}<br />{{Func|file:append-text-lines|$path as xs:string, $values as xs:string*, $encoding as xs:string|empty-sequence()}}<br />
 
|{{Func|file:append-text-lines|$path as xs:string, $values as xs:string*|empty-sequence()}}<br />{{Func|file:append-text-lines|$path as xs:string, $values as xs:string*, $encoding as xs:string|empty-sequence()}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Appends a sequence of strings to the specified file, each followed by the system specific newline character. If the specified file does not exists, a new file is created.<br />The optional parameter {{Code|$encoding}} defines the output encoding (default: UTF-8).<br />
 
|Appends a sequence of strings to the specified file, each followed by the system specific newline character. If the specified file does not exists, a new file is created.<br />The optional parameter {{Code|$encoding}} defines the output encoding (default: UTF-8).<br />
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|no-dir|#Errors}} the parent of specified path is no directory.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|unknown-encoding|#Errors}} the specified encoding is not supported, or unknown.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
 
|{{Error|no-dir|#Errors}} the parent of specified path is no directory.<br />{{Error|is-dir|#Errors}} the specified path is a directory.<br />{{Error|unknown-encoding|#Errors}} the specified encoding is not supported, or unknown.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
 
|}
 
|}
  
 +
==file:copy==
  
==file:copy==
 
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:copy|$source as xs:string, $target as xs:string|empty-sequence()}}<br />
 
|{{Func|file:copy|$source as xs:string, $target as xs:string|empty-sequence()}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Copies a file or directory specified by {{Code|$source}} to the file or directory specified by {{Code|$target}}. If the target file already exists, it will be overwritten. No operation will be performed if the source and target path are equal.<br />
 
|Copies a file or directory specified by {{Code|$source}} to the file or directory specified by {{Code|$target}}. If the target file already exists, it will be overwritten. No operation will be performed if the source and target path are equal.<br />
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|not-found|#Errors}} the specified source does not exist.<br />{{Error|exists|#Errors}} the specified source is a directory and the target is a file.<br />{{Error|no-dir|#Errors}} the parent of the specified target is no directory.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
 
|{{Error|not-found|#Errors}} the specified source does not exist.<br />{{Error|exists|#Errors}} the specified source is a directory and the target is a file.<br />{{Error|no-dir|#Errors}} the parent of the specified target is no directory.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
Line 302: Line 341:
  
 
==file:move==
 
==file:move==
 +
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:move|$source as xs:string, $target as xs:string|empty-sequence()}}<br />
 
|{{Func|file:move|$source as xs:string, $target as xs:string|empty-sequence()}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Moves or renames the file or directory specified by {{Code|$source}} to the path specified by {{Code|$target}}. If the target file already exists, it will be overwritten. No operation will be performed if the source and target path are equal.<br />
 
|Moves or renames the file or directory specified by {{Code|$source}} to the path specified by {{Code|$target}}. If the target file already exists, it will be overwritten. No operation will be performed if the source and target path are equal.<br />
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|not-found|#Errors}} the specified source does not exist.<br />{{Error|exists|#Errors}} the specified source is a directory and the target is a file.<br />{{Error|no-dir|#Errors}} the parent of the specified target is no directory.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
 
|{{Error|not-found|#Errors}} the specified source does not exist.<br />{{Error|exists|#Errors}} the specified source is a directory and the target is a file.<br />{{Error|no-dir|#Errors}} the parent of the specified target is no directory.<br />{{Error|io-error|#Errors}} the operation fails for some other reason.<br />
Line 317: Line 357:
  
 
==file:exists==
 
==file:exists==
 +
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:exists|$path as xs:string|xs:boolean}}<br />
 
|{{Func|file:exists|$path as xs:string|xs:boolean}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Returns an {{Code|xs:boolean}} indicating whether a file or directory specified by {{Code|$path}} exists in the file system.<br />
 
|Returns an {{Code|xs:boolean}} indicating whether a file or directory specified by {{Code|$path}} exists in the file system.<br />
Line 329: Line 370:
  
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:is-dir|$path as xs:string|xs:boolean}}<br />
 
|{{Func|file:is-dir|$path as xs:string|xs:boolean}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Returns an {{Code|xs:boolean}} indicating whether the argument {{Code|$path}} points to an existing directory.<br />
 
|Returns an {{Code|xs:boolean}} indicating whether the argument {{Code|$path}} points to an existing directory.<br />
Line 340: Line 381:
  
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:is-absolute|$path as xs:string|xs:boolean}}<br />
 
|{{Func|file:is-absolute|$path as xs:string|xs:boolean}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Returns an {{Code|xs:boolean}} indicating whether the argument {{Code|$path}} is absolute.<br />The behavior of this function depends on the operating system: On Windows, an absolute path starts with the drive letter and a colon, whereas on Linux it starts with a slash.
 
|Returns an {{Code|xs:boolean}} indicating whether the argument {{Code|$path}} is absolute.<br />The behavior of this function depends on the operating system: On Windows, an absolute path starts with the drive letter and a colon, whereas on Linux it starts with a slash.
Line 349: Line 390:
  
 
==file:is-file==
 
==file:is-file==
 +
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:is-file|$path as xs:string|xs:boolean}}<br />
 
|{{Func|file:is-file|$path as xs:string|xs:boolean}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Returns an {{Code|xs:boolean}} indicating whether the argument {{Code|$path}} points to an existing file.<br />
 
|Returns an {{Code|xs:boolean}} indicating whether the argument {{Code|$path}} points to an existing file.<br />
Line 359: Line 401:
  
 
==file:last-modified==
 
==file:last-modified==
 +
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:last-modified|$path as xs:string|xs:dateTime}}<br />
 
|{{Func|file:last-modified|$path as xs:string|xs:dateTime}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Retrieves the timestamp of the last modification of the file or directory specified by {{Code|$path}}.<br />
 
|Retrieves the timestamp of the last modification of the file or directory specified by {{Code|$path}}.<br />
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|not-found|#Errors}} the specified path does not exist.<br />
 
|{{Error|not-found|#Errors}} the specified path does not exist.<br />
Line 372: Line 415:
  
 
==file:size==
 
==file:size==
 +
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
|{{Func|file:size|$file as xs:string|xs:integer}}<br />
+
|{{Func|file:size|$path as xs:string|xs:integer}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Returns the size, in bytes, of the file specified by {{Code|$path}}, or {{Code|0}} for directories.<br />
 
|Returns the size, in bytes, of the file specified by {{Code|$path}}, or {{Code|0}} for directories.<br />
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|not-found|#Errors}} the specified file does not exist.<br />
 
|{{Error|not-found|#Errors}} the specified file does not exist.<br />
Line 387: Line 431:
  
 
==file:name==
 
==file:name==
 +
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:name|$path as xs:string|xs:string}}
 
|{{Func|file:name|$path as xs:string|xs:string}}
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Returns the name of a file or directory specified by {{Code|$path}}. An empty string is returned if the path points to the root directory.
 
|Returns the name of a file or directory specified by {{Code|$path}}. An empty string is returned if the path points to the root directory.
Line 399: Line 444:
  
 
{| width='100%'
 
{| width='100%'
|-
+
 
 +
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:parent|$path as xs:string|xs:string?}}<br />
 
|{{Func|file:parent|$path as xs:string|xs:string?}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
|Returns the absolute path to the parent directory of a file or directory specified by {{Code|$path}}. An empty sequence is returned if the path points to a root directory.<br/>The inverse function is [[#file:children|file:children]].<br />
+
|Returns the absolute path to the parent directory of a file or directory specified by {{Code|$path}}. An empty sequence is returned if the path points to a root directory.<br/>The inverse function is {{Function||file:children}}.<br />
|-
+
|- valign="top"
 
| '''Examples'''
 
| '''Examples'''
 
|
 
|
Line 412: Line 458:
  
 
==file:path-to-native==
 
==file:path-to-native==
 +
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:path-to-native|$path as xs:string|xs:string}}<br />
 
|{{Func|file:path-to-native|$path as xs:string|xs:string}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Transforms the {{Code|$path}} argument to its native representation on the operating system.<br />
 
|Transforms the {{Code|$path}} argument to its native representation on the operating system.<br />
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|not-found|#Errors}} the specified file does not exist.<br />{{Error|io-error|#Errors}} the specified path cannot be transformed to its native representation.<br />
 
|{{Error|not-found|#Errors}} the specified file does not exist.<br />{{Error|io-error|#Errors}} the specified path cannot be transformed to its native representation.<br />
Line 427: Line 474:
  
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:resolve-path|$path as xs:string|xs:string}}<br />{{Func|file:resolve-path|$path as xs:string, $base as xs:string|xs:string}}<br />
 
|{{Func|file:resolve-path|$path as xs:string|xs:string}}<br />{{Func|file:resolve-path|$path as xs:string, $base as xs:string|xs:string}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Transforms the {{Code|$path}} argument to an absolute operating system path.<br />If the path is relative, and if an absolute {{Code|$base}} path is specified, it will be resolved against this path.
 
|Transforms the {{Code|$path}} argument to an absolute operating system path.<br />If the path is relative, and if an absolute {{Code|$base}} path is specified, it will be resolved against this path.
|-
+
|- valign="top"
 
| '''Errors'''
 
| '''Errors'''
 
|{{Error|is-relative|#Errors}} the specified base path is relative.<br />
 
|{{Error|is-relative|#Errors}} the specified base path is relative.<br />
|-
+
|- valign="top"
 
| '''Examples'''
 
| '''Examples'''
 
|The following examples apply to Windows:
 
|The following examples apply to Windows:
Line 445: Line 492:
  
 
==file:path-to-uri==
 
==file:path-to-uri==
 +
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:path-to-uri|$path as xs:string|xs:string}}<br />
 
|{{Func|file:path-to-uri|$path as xs:string|xs:string}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Transforms the path specified by {{Code|$path}} into a URI with the {{Code|file://}} scheme.<br />
 
|Transforms the path specified by {{Code|$path}} into a URI with the {{Code|file://}} scheme.<br />
Line 457: Line 505:
  
 
==file:dir-separator==
 
==file:dir-separator==
 +
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Code|'''file:dir-separator'''() as xs:string}}<br />
 
|{{Code|'''file:dir-separator'''() as xs:string}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Returns the directory separator used by the operating system, such as {{Code|/}} or {{Code|\}}.<br />
 
|Returns the directory separator used by the operating system, such as {{Code|/}} or {{Code|\}}.<br />
Line 467: Line 516:
  
 
==file:path-separator==
 
==file:path-separator==
 +
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Code|'''file:path-separator'''() as xs:string}}<br />
 
|{{Code|'''file:path-separator'''() as xs:string}}<br />
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Returns the path separator used by the operating system, such as {{Code|;}} or {{Code|:}}.<br />
 
|Returns the path separator used by the operating system, such as {{Code|;}} or {{Code|:}}.<br />
Line 477: Line 527:
  
 
==file:line-separator==
 
==file:line-separator==
 +
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:line-separator||xs:string}}
 
|{{Func|file:line-separator||xs:string}}
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Returns the line separator used by the operating system, such as {{Code|&amp;#10;}}, {{Code|&amp;#13;&amp;#10;}} or {{Code|&amp;#13;}}.<br />
 
|Returns the line separator used by the operating system, such as {{Code|&amp;#10;}}, {{Code|&amp;#13;&amp;#10;}} or {{Code|&amp;#13;}}.<br />
Line 489: Line 540:
  
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:temp-dir||xs:string}}
 
|{{Func|file:temp-dir||xs:string}}
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Returns the system’s default temporary-file directory.<br />
 
|Returns the system’s default temporary-file directory.<br />
Line 500: Line 551:
  
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:current-dir||xs:string}}
 
|{{Func|file:current-dir||xs:string}}
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Returns the current working directory. This function returns the same result as the function call <code>file:resolve-path("")</code>.
 
|Returns the current working directory. This function returns the same result as the function call <code>file:resolve-path("")</code>.
Line 511: Line 562:
  
 
{| width='100%'
 
{| width='100%'
|-
+
|- valign="top"
 
| width='120' | '''Signatures'''
 
| width='120' | '''Signatures'''
 
|{{Func|file:base-dir||xs:string?}}
 
|{{Func|file:base-dir||xs:string?}}
|-
+
|- valign="top"
 
| '''Summary'''
 
| '''Summary'''
 
|Returns the parent directory of the static base URI. If the Base URI property is undefined, the empty sequence is returned. - If a static base URI exists, and if points to a local file path, this function returns the same result as the expression {{Code|file:parent(static-base-uri())}}.
 
|Returns the parent directory of the static base URI. If the Base URI property is undefined, the empty sequence is returned. - If a static base URI exists, and if points to a local file path, this function returns the same result as the expression {{Code|file:parent(static-base-uri())}}.
Line 524: Line 575:
 
! width="160"|Code
 
! width="160"|Code
 
|Description
 
|Description
|-
+
|- valign="top"
 
|{{Code|exists}}
 
|{{Code|exists}}
 
|A file with the same path already exists.
 
|A file with the same path already exists.
|-
+
|- valign="top"
 
|{{Code|invalid-path}}
 
|{{Code|invalid-path}}
 
|A specified path is invalid.
 
|A specified path is invalid.
|-
+
|- valign="top"
 
|{{Code|io-error}}
 
|{{Code|io-error}}
 
|The operation fails for some other reason specific to the operating system.
 
|The operation fails for some other reason specific to the operating system.
|-
+
|- valign="top"
 
|{{Code|is-dir}}
 
|{{Code|is-dir}}
 
|The specified path is a directory.
 
|The specified path is a directory.
|-
+
|- valign="top"
 
|{{Code|is-relative}}
 
|{{Code|is-relative}}
 
|The specified path is relative (and must be absolute).
 
|The specified path is relative (and must be absolute).
|-
+
|- valign="top"
 
|{{Code|no-dir}}
 
|{{Code|no-dir}}
 
|The specified path does not point to a directory.
 
|The specified path does not point to a directory.
|-
+
|- valign="top"
 
|{{Code|not-found}}
 
|{{Code|not-found}}
 
|A specified path does not exist.
 
|A specified path does not exist.
|-
+
|- valign="top"
 
|{{Code|out-of-range}}
 
|{{Code|out-of-range}}
 
|The specified offset or length is negative, or the chosen values would exceed the file bounds.
 
|The specified offset or length is negative, or the chosen values would exceed the file bounds.
|-
+
|- valign="top"
 
|{{Code|unknown-encoding}}
 
|{{Code|unknown-encoding}}
 
|The specified encoding is not supported, or unknown.
 
|The specified encoding is not supported, or unknown.
Line 554: Line 605:
  
 
=Changelog=
 
=Changelog=
 +
 +
;Version 9.3
 +
* Added: {{Function||file:descendants}}
  
 
;Version 9.0
 
;Version 9.0
* Updated: [[#file:read-text-lines|file:read-text-lines]]: <code>$offset</code> and <code>$length</code> arguments added.
+
* Updated: {{Function||file:read-text-lines}}: <code>$offset</code> and <code>$length</code> arguments added.
  
 
;Version 8.5
 
;Version 8.5
* Updated: [[#file:read-text|file:read-text]], [[#file:read-text-lines|file:read-text-lines]]: <code>$fallback</code> argument added.
+
* Updated: {{Function||file:read-text}}, {{Function||file:read-text-lines}}: <code>$fallback</code> argument added.
  
 
;Version 8.2
 
;Version 8.2
* Added: [[#file:is-absolute|file:is-absolute]]
+
* Added: {{Function||file:is-absolute}}
* Updated: [[#file:resolve-path|file:resolve-path]]: base argument added
+
* Updated: {{Function||file:resolve-path}}: base argument added
  
 
;Version 8.0
 
;Version 8.0
* Added: [[#file:current-dir|file:current-dir]], [[#file:base-dir|file:base-dir]], [[#file:children|file:children]]
+
* Added: {{Function||file:current-dir}}, {{Function||file:base-dir}}, {{Function||file:children}}
  
 
;Version 7.8
 
;Version 7.8
* Added: [[#file:parent|file:parent]], [[#file:name|file:name]]
+
* Added: {{Function||file:parent}}, {{Function||file:name}}
* Updated: error codes; [[#file:read-binary|file:read-binary]], [[#file:write-binary|file:write-binary]]: {{Code|$offset}} and {{Code|$length}} arguments added.
+
* Updated: error codes; {{Function||file:read-binary}}, {{Function||file:write-binary}}: {{Code|$offset}} and {{Code|$length}} arguments added.
 
* Deleted: file:base-name, file:dir-name
 
* Deleted: file:base-name, file:dir-name
  
 
;Version 7.7
 
;Version 7.7
* Added: [[#file:create-temp-dir|file:create-temp-dir]], [[#file:create-temp-file|file:create-temp-file]], [[#file:temp-dir|file:temp-dir]]
+
* Added: {{Function||file:create-temp-dir}}, {{Function||file:create-temp-file}}, {{Function||file:temp-dir}}
 
* Updated: all returned strings that refer to existing directories will be suffixed with a directory separator.
 
* Updated: all returned strings that refer to existing directories will be suffixed with a directory separator.
  
 
;Version 7.3
 
;Version 7.3
* Added: [[#file:append-text|file:append-text]], [[#file:write-text|file:write-text]], [[#file:append-text-lines|file:append-text-lines]], [[#file:write-text-lines|file:write-text-lines]], [[#file:line-separator|file:line-separator]]
+
* Added: {{Function||file:append-text}}, {{Function||file:write-text}}, {{Function||file:append-text-lines}}, {{Function||file:write-text-lines}}, {{Function||file:line-separator}}
* Aligned with latest specification: $file:directory-separator → [[#file:dir-separator|file:dir-separator]], $file:path-separator → [[#file:path-separator|file:path-separator]], file:is-directory → [[#file:is-dir|file:is-dir]], file:create-directory → [[#file:create-dir|file:create-dir]]
+
* Aligned with latest specification: $file:directory-separator → {{Function||file:dir-separator}}, $file:path-separator → {{Function||file:path-separator}}, file:is-directory → {{Function||file:is-dir}}, file:create-directory → {{Function||file:create-dir}}
* Updated: [[#file:write-binary|file:write-binary]], [[#file:append-binary|file:append-binary]]: output limited to a single value
+
* Updated: {{Function||file:write-binary}}, {{Function||file:append-binary}}: output limited to a single value
  
 
;Version 7.2.1
 
;Version 7.2.1
* Updated: [[#file:delete|file:delete]]: {{Code|$recursive}} parameter added to prevent sub-directories from being accidentally deleted.
+
* Updated: {{Function||file:delete}}: {{Code|$recursive}} parameter added to prevent subdirectories from being accidentally deleted.
* Fixed: [[#file:list|file:list]] now returns relative instead of absolute paths.
+
* Fixed: {{Function||file:list}} now returns relative instead of absolute paths.

Latest revision as of 15:58, 25 July 2022

This XQuery Module contains functions related to file system operations, such as listing, reading, or writing files.

This module is based on the EXPath File Module. The following enhancements have not been added to the specification yet:

Function Description
file:descendants new function
file:is-absolute new function
file:read-text, file:read-text-lines $fallback argument added
file:read-text-lines $offset and $length arguments added
file:resolve-path $base argument added

Conventions[edit]

All functions and errors in this module are assigned to the http://expath.org/ns/file namespace, which is statically bound to the file prefix.

For serialization parameters, the http://www.w3.org/2010/xslt-xquery-serialization namespace is used, which is statically bound to the output prefix.

The error invalid-path is raised if a path is invalid.

File Paths[edit]

  • All file paths are resolved against the current working directory (the directory from which BaseX or, more generally, the Java Virtual Machine, was started). This directory can be retrieved via file:base-dir.
  • A path can be specified as local filesystem path or as file URI.
  • Returned strings that refer to existing directories are suffixed with a directory separator.

Read Operations[edit]

file:list[edit]

Signatures file:list($dir as xs:string) as xs:string*
file:list($dir as xs:string, $recursive as xs:boolean) as xs:string*
file:list($dir as xs:string, $recursive as xs:boolean, $pattern as xs:string) as xs:string*
Summary Lists all files and directories found in the specified $dir. The returned paths are relative to the provided path.
The optional parameter $recursive specifies whether subdirectories will be traversed, too.
The optional parameter $pattern defines a file name pattern in the Glob Syntax. If present, only those files and directories are returned that correspond to the pattern. Several patterns can be separated with a comma (,).
Errors not-found: the specified file does not exist.
no-dir: the specified path does not point to a directory.
io-error: the operation fails for some other reason.

file:children[edit]

Signatures file:children($dir as xs:string) as xs:string*
Summary Returns the full paths to all files and directories found in the specified $dir.
The inverse function is file:parent. The related function file:list returns relative file paths.
Errors not-found: the specified file does not exist.
no-dir: the specified path does not point to a directory.
io-error: the operation fails for some other reason.

file:descendants[edit]

Signatures file:descendants($dir as xs:string) as xs:string*
Summary Returns the full paths to all files and directories found in the specified $dir and its subdirectories.
. The related function file:list returns relative file paths.
Errors not-found: the specified file does not exist.
no-dir: the specified path does not point to a directory.
io-error: the operation fails for some other reason.

file:read-binary[edit]

Signatures file:read-binary($path as xs:string) as xs:base64Binary
file:read-binary($path as xs:string, $offset as xs:integer) as xs:base64Binary
file:read-binary($path as xs:string, $offset as xs:integer, $length as xs:integer) as xs:base64Binary
Summary Reads the binary content of the file specified by $path and returns it as lazy xs:base64Binary item.
The optional parameters $offset and $length can be used to read chunks of a file.
Errors not-found: the specified file does not exist.
is-dir: the specified path is a directory.
out-of-range: the offset or length is negative, or the chosen values would exceed the file bounds.
io-error: the operation fails for some other reason.
Examples
  • lazy:cache(file:read-binary("config.data")) enforces the file access (otherwise, it will be delayed until requested first).

file:read-text[edit]

Signatures file:read-text($path as xs:string) as xs:string
file:read-text($path as xs:string, $encoding as xs:string) as xs:string
file:read-text($path as xs:string, $encoding as xs:string, $fallback as xs:boolean) as xs:string
Summary Reads the textual contents of the file specified by $path and returns it as lazy xs:string item:
  • The UTF-8 default encoding can be overwritten with the optional $encoding argument.
  • By default, invalid characters will be rejected. If $fallback is set to true, these characters will be replaced with the Unicode replacement character FFFD (�).
Errors not-found: the specified file does not exist.
is-dir: the specified path is a directory.
unknown-encoding: the specified encoding is not supported, or unknown.
io-error: the operation fails for some other reason.
Examples
  • lazy:cache(file:read-text("ids.txt")) enforces the file access (otherwise, it will be delayed until requested first).

file:read-text-lines[edit]

Signatures file:read-text-lines($path as xs:string) as xs:string*
file:read-text-lines($path as xs:string, $encoding as xs:string) as xs:string*
file:read-text-lines($path as xs:string, $encoding as xs:string, $fallback as xs:boolean) as xs:string*
file:read-text-lines($path as xs:string, $encoding as xs:string, $fallback as xs:boolean, $offset as xs:integer) as xs:string*
file:read-text-lines($path as xs:string, $encoding as xs:string, $fallback as xs:boolean, $offset as xs:integer, $length as xs:integer) as xs:string*
Summary Reads the textual contents of the file specified by $path and returns it as a sequence of xs:string items:
  • The UTF-8 default encoding can be overwritten with the optional $encoding argument.
  • By default, invalid characters will be rejected. If $fallback is set to true, these characters will be replaced with the Unicode replacement character FFFD (�).

The lines to be read can be restricted with the optional parameters $offset and $length.

Errors not-found: the specified file does not exist.
is-dir: the specified path is a directory.
unknown-encoding: the specified encoding is not supported, or unknown.
io-error: the operation fails for some other reason.

Write Operations[edit]

file:create-dir[edit]

Signatures file:create-dir($dir as xs:string) as empty-sequence()
Summary Creates the directory specified by $dir if it does not already exist. Non-existing parent directories will be created as well.
Errors exists: the specified target exists, but is no directory.
io-error: the operation fails for some other reason.

file:create-temp-dir[edit]

Signatures file:create-temp-dir($prefix as xs:string, $suffix as xs:string) as xs:string
file:create-temp-dir($prefix as xs:string, $suffix as xs:string, $dir as xs:string) as xs:string
Summary Creates a new temporary directory that did not exist before this function was called, and returns its full file path. The directory name begins and ends with the specified $prefix and $suffix. If no directory is specified via $dir, the directory will be placed in the system’s default temporary directory. The operation will create all non-existing parent directories.
Errors no-dir: the specified directory points to a file.
io-error: the directory could not be created.

file:create-temp-file[edit]

Signatures file:create-temp-file($prefix as xs:string, $suffix as xs:string) as xs:string
file:create-temp-file($prefix as xs:string, $suffix as xs:string, $dir as xs:string) as xs:string
Summary Creates a new temporary file that did not exist before this function was called, and returns its full file path. The file name begins and ends with the specified $prefix and $suffix. If no directory is specified via $dir, the file will be placed in the system’s default temporary directory. The operation will create all non-existing parent directories.
Errors no-dir: the specified directory points to a file.
io-error: the directory could not be created.

file:delete[edit]

Signatures file:delete($path as xs:string) as empty-sequence()
file:delete($path as xs:string, $recursive as xs:boolean) as empty-sequence()
Summary Recursively deletes a file or directory specified by $path.
The optional parameter $recursive specifies whether subdirectories will be deleted, too.
Errors not-found: the specified path does not exist.
io-error: the operation fails for some other reason.

file:write[edit]

Signatures file:write($path as xs:string, $items as item()*) as empty-sequence()
file:write($path as xs:string, $items as item()*, $params as item()) as empty-sequence()
Summary Writes a serialized sequence of items to the specified file. If the file already exists, it will be overwritten.
The $params argument contains serialization parameters. As with fn:serialize(), the parameters can be specified
  • either as children of an <output:serialization-parameters/> element:
<output:serialization-parameters>
  <output:method value='xml'/>
  <output:cdata-section-elements value="div"/>
  ...
</output:serialization-parameters>
  • or as map, which contains all key/value pairs:
map { "method": "xml", "cdata-section-elements": "div", ... }
Errors no-dir: the parent of specified path is no directory.
is-dir: the specified path is a directory.
io-error: the operation fails for some other reason.
Examples
  • file:write('data.bin', xs:hexBinary('414243')) writes a hex representation to the specified file.
  • file:write('data.bin', xs:hexBinary('414243'), map { 'method': 'basex') writes binary data to the specified file (see Serialization for more details).

file:write-binary[edit]

Signatures file:write-binary($path as xs:string, $value as xs:anyAtomicType) as empty-sequence()
file:write-binary($path as xs:string, $value as xs:anyAtomicType, $offset as xs:integer) as empty-sequence()
Summary Writes a binary item (xs:base64Binary, xs:hexBinary) to the specified file. If the file already exists, it will be overwritten.
If $offset is specified, data will be written at this file position. An existing file may be resized by that operation.
Errors no-dir: the parent of specified path is no directory.
is-dir: the specified path is a directory.
out-of-range: the offset is negative, or it exceeds the current file size.
io-error: the operation fails for some other reason.

file:write-text[edit]

Signatures file:write-text($path as xs:string, $value as xs:string) as empty-sequence()
file:write-text($path as xs:string, $value as xs:string, $encoding as xs:string) as empty-sequence()
Summary Writes a string to the specified file. If the file already exists, it will be overwritten.
The optional parameter $encoding defines the output encoding (default: UTF-8).
Errors no-dir: the parent of specified path is no directory.
is-dir: the specified path is a directory.
unknown-encoding: the specified encoding is not supported, or unknown.
io-error: the operation fails for some other reason.

file:write-text-lines[edit]

Signatures file:write-text-lines($path as xs:string, $values as xs:string*) as empty-sequence()
file:write-text-lines($path as xs:string, $values as xs:string*, $encoding as xs:string) as empty-sequence()
Summary Writes a sequence of strings to the specified file, each followed by the system specific newline character. If the file already exists, it will be overwritten.
The optional parameter $encoding defines the output encoding (default: UTF-8).
Errors no-dir: the parent of specified path is no directory.
is-dir: the specified path is a directory.
unknown-encoding: the specified encoding is not supported, or unknown.
io-error: the operation fails for some other reason.

file:append[edit]

Signatures file:append($path as xs:string, $items as item()*) as empty-sequence()
file:append($path as xs:string, $items as item()*, $params as item()) as empty-sequence()
Summary Appends a serialized sequence of items to the specified file. If the file does not exists, a new file is created.
Errors no-dir: the parent of specified path is no directory.
is-dir: the specified path is a directory.
io-error: the operation fails for some other reason.

file:append-binary[edit]

Signatures file:append-binary($path as xs:string, $value as xs:anyAtomicType) as empty-sequence()
Summary Appends a binary item (xs:base64Binary, xs:hexBinary) to the specified file. If the file does not exists, a new one is created.
Errors no-dir: the parent of specified path is no directory.
is-dir: the specified path is a directory.
io-error: the operation fails for some other reason.

file:append-text[edit]

Signatures file:append-text($path as xs:string, $value as xs:string) as empty-sequence()
file:append-text($path as xs:string, $value as xs:string, $encoding as xs:string) as empty-sequence()
Summary Appends a string to a file specified by $path. If the specified file does not exists, a new file is created.
The optional parameter $encoding defines the output encoding (default: UTF-8).
Errors no-dir: the parent of specified path is no directory.
is-dir: the specified path is a directory.
unknown-encoding: the specified encoding is not supported, or unknown.
io-error: the operation fails for some other reason.

file:append-text-lines[edit]

Signatures file:append-text-lines($path as xs:string, $values as xs:string*) as empty-sequence()
file:append-text-lines($path as xs:string, $values as xs:string*, $encoding as xs:string) as empty-sequence()
Summary Appends a sequence of strings to the specified file, each followed by the system specific newline character. If the specified file does not exists, a new file is created.
The optional parameter $encoding defines the output encoding (default: UTF-8).
Errors no-dir: the parent of specified path is no directory.
is-dir: the specified path is a directory.
unknown-encoding: the specified encoding is not supported, or unknown.
io-error: the operation fails for some other reason.

file:copy[edit]

Signatures file:copy($source as xs:string, $target as xs:string) as empty-sequence()
Summary Copies a file or directory specified by $source to the file or directory specified by $target. If the target file already exists, it will be overwritten. No operation will be performed if the source and target path are equal.
Errors not-found: the specified source does not exist.
exists: the specified source is a directory and the target is a file.
no-dir: the parent of the specified target is no directory.
io-error: the operation fails for some other reason.

file:move[edit]

Signatures file:move($source as xs:string, $target as xs:string) as empty-sequence()
Summary Moves or renames the file or directory specified by $source to the path specified by $target. If the target file already exists, it will be overwritten. No operation will be performed if the source and target path are equal.
Errors not-found: the specified source does not exist.
exists: the specified source is a directory and the target is a file.
no-dir: the parent of the specified target is no directory.
io-error: the operation fails for some other reason.

File Properties[edit]

file:exists[edit]

Signatures file:exists($path as xs:string) as xs:boolean
Summary Returns an xs:boolean indicating whether a file or directory specified by $path exists in the file system.

file:is-dir[edit]

Signatures file:is-dir($path as xs:string) as xs:boolean
Summary Returns an xs:boolean indicating whether the argument $path points to an existing directory.

file:is-absolute[edit]

Signatures file:is-absolute($path as xs:string) as xs:boolean
Summary Returns an xs:boolean indicating whether the argument $path is absolute.
The behavior of this function depends on the operating system: On Windows, an absolute path starts with the drive letter and a colon, whereas on Linux it starts with a slash.

file:is-file[edit]

Signatures file:is-file($path as xs:string) as xs:boolean
Summary Returns an xs:boolean indicating whether the argument $path points to an existing file.

file:last-modified[edit]

Signatures file:last-modified($path as xs:string) as xs:dateTime
Summary Retrieves the timestamp of the last modification of the file or directory specified by $path.
Errors not-found: the specified path does not exist.

file:size[edit]

Signatures file:size($path as xs:string) as xs:integer
Summary Returns the size, in bytes, of the file specified by $path, or 0 for directories.
Errors not-found: the specified file does not exist.

Path Functions[edit]

file:name[edit]

Signatures file:name($path as xs:string) as xs:string
Summary Returns the name of a file or directory specified by $path. An empty string is returned if the path points to the root directory.

file:parent[edit]

Signatures file:parent($path as xs:string) as xs:string?
Summary Returns the absolute path to the parent directory of a file or directory specified by $path. An empty sequence is returned if the path points to a root directory.
The inverse function is file:children.
Examples
  • file:parent(static-base-uri()) returns the directory of the current XQuery module.

file:path-to-native[edit]

Signatures file:path-to-native($path as xs:string) as xs:string
Summary Transforms the $path argument to its native representation on the operating system.
Errors not-found: the specified file does not exist.
io-error: the specified path cannot be transformed to its native representation.

file:resolve-path[edit]

Signatures file:resolve-path($path as xs:string) as xs:string
file:resolve-path($path as xs:string, $base as xs:string) as xs:string
Summary Transforms the $path argument to an absolute operating system path.
If the path is relative, and if an absolute $base path is specified, it will be resolved against this path.
Errors is-relative: the specified base path is relative.
Examples The following examples apply to Windows:
  • file:resolve-path('file.txt', 'C:/Temp/') returns C:/Temp/file.txt.
  • file:resolve-path('file.txt', 'C:/Temp') returns C:/file.txt.
  • file:resolve-path('file.txt', 'Temp') raises an error.

file:path-to-uri[edit]

Signatures file:path-to-uri($path as xs:string) as xs:string
Summary Transforms the path specified by $path into a URI with the file:// scheme.

System Properties[edit]

file:dir-separator[edit]

Signatures file:dir-separator() as xs:string
Summary Returns the directory separator used by the operating system, such as / or \.

file:path-separator[edit]

Signatures file:path-separator() as xs:string
Summary Returns the path separator used by the operating system, such as ; or :.

file:line-separator[edit]

Signatures file:line-separator() as xs:string
Summary Returns the line separator used by the operating system, such as &#10;, &#13;&#10; or &#13;.

file:temp-dir[edit]

Signatures file:temp-dir() as xs:string
Summary Returns the system’s default temporary-file directory.

file:current-dir[edit]

Signatures file:current-dir() as xs:string
Summary Returns the current working directory. This function returns the same result as the function call file:resolve-path("").

file:base-dir[edit]

Signatures file:base-dir() as xs:string?
Summary Returns the parent directory of the static base URI. If the Base URI property is undefined, the empty sequence is returned. - If a static base URI exists, and if points to a local file path, this function returns the same result as the expression file:parent(static-base-uri()).

Errors[edit]

Code Description
exists A file with the same path already exists.
invalid-path A specified path is invalid.
io-error The operation fails for some other reason specific to the operating system.
is-dir The specified path is a directory.
is-relative The specified path is relative (and must be absolute).
no-dir The specified path does not point to a directory.
not-found A specified path does not exist.
out-of-range The specified offset or length is negative, or the chosen values would exceed the file bounds.
unknown-encoding The specified encoding is not supported, or unknown.

Changelog[edit]

Version 9.3
Version 9.0
Version 8.5
Version 8.2
Version 8.0
Version 7.8
Version 7.7
Version 7.3
Version 7.2.1
  • Updated: file:delete: $recursive parameter added to prevent subdirectories from being accidentally deleted.
  • Fixed: file:list now returns relative instead of absolute paths.