Changes

Jump to navigation Jump to search
34 bytes added ,  16:20, 27 February 2020
no edit summary
The XQuery expression below serves as an example on how large files can be downloaded and written to a file with constant memory consumption:
<pre classsyntaxhighlight lang="brush:xquery">
file:write-binary('output.data', fetch:binary('http://files.basex.org/xml/xmark111mb.zip'))
</presyntaxhighlight>
If lazy items are serialized, they will be streamed as well.
| '''Example'''
|In the following example, a file will be deleted before its content is returned. To avoid a “file not found” error when serializing the result, the content must be cached:
<pre classsyntaxhighlight lang="brush:xquery">
let $file := 'data.txt'
let $text := lazy:cache(file:read-text($file))
return (file:delete($file), $text)
</presyntaxhighlight>
|}
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu