dba/files
library moduleR
Summary
Create directory.
- Tags
Author: Christian Grün, BaseX Team 2005-21, BSD License
__source : files/dir-create.xqm
Imports
This module is imported by 0 modules. It imports 1 modules.
Variables
Functions
4.1 dba:dir-create
Arities: dba:dir-create#1R
dba:dir-create
(
$name
as
xs:string
)
as
element(rest:response)
- name
as
xs:string
name of directory to create
element(rest:response)
redirection
Invokes 3 functions from 3 modules
- config:directory#0
- {http://basex.org/modules/web}redirect#2
- {http://expath.org/ns/file}create-dir#1
Invoked by 0 functions from 0 modules
Annotations
%rest:POST | () |
%rest:path | ('/dba/dir-create') |
%rest:query-param | ('name','{$name}') |
Source ( 6 lines)
function dba:dir-create(
$name as xs:string
) as element(rest:response) {
file:create-dir(config:directory() || $name),
web:redirect($dba:CAT, map { 'info': 'Directory "' || $name || '" was created.' })
}
Namespaces
The following namespaces are defined:
Prefix | Uri |
---|---|
config | dba/config |
dba | dba/files 2 3 4 5 6 7 8 |
rest | http://exquery.org/ns/restxq |
Source Code
(:~
: Create directory.
:
: @author Christian Grün, BaseX Team 2005-21, BSD License
:)
module namespace dba = 'dba/files';
import module namespace config = 'dba/config' at '../lib/config.xqm';
(:~ Top category :)
declare variable $dba:CAT := 'files';
(:~
: Creates a directory.
: @param $name name of directory to create
: @return redirection
:)
declare
%rest:POST
%rest:path('/dba/dir-create')
%rest:query-param('name', '{$name}')
function dba:dir-create(
$name as xs:string
) as element(rest:response) {
file:create-dir(config:directory() || $name),
web:redirect($dba:CAT, map { 'info': 'Directory "' || $name || '" was created.' })
};