Skip to content

Instantly share code, notes, and snippets.

@joewiz
Created July 10, 2017 03:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joewiz/aa8d84500b1f1478779cdf2cc1934348 to your computer and use it in GitHub Desktop.
Save joewiz/aa8d84500b1f1478779cdf2cc1934348 to your computer and use it in GitHub Desktop.
Save a resource stored in eXist to the file system as a zip file
xquery version "3.1";
(: Save a resource stored in eXist to the file system as a zip file :)
let $source := "/db/apps/frus-dates/data/frus-dates.xml"
let $destination := "/Users/joe/Downloads/frus-dates.zip"
let $preserve-collection-structure := false()
return
file:serialize-binary(
compression:zip(xs:anyURI($source), $preserve-collection-structure),
xs:anyURI($destination)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment