Compress a collection to a zip folder
Issues related to W3C XQuery.
-
- Posts: 7
- Joined: Thu Mar 06, 2014 9:14 pm
Compress a collection to a zip folder
Hi guys,
I use eXist 2.2RC1 for this project.
I need to archive the contents of a collection (two .doc and a .vbs files) to a zip file using xQuery.
After some research, I found out about two functions that could help me out:
- compression:zip()
- response-stream-binary()
Now, the first function apparently enables us to zip either a set of entries or a collection to a zip file. I'm not sure if the second one is useful or not but since it enables us to specify the mimetype and the output name, I thought it might be.
The problem is that I can't seem to find how to indicate the target location of the output zip folder. As a result, the zip never gets created as a physical folder. I can display what seems to be the output stream using the response:stream binary() function but I actually have to store the zip file somewhere on the database.
This is what I've been doing so far:
Does any of you have an idea how to proceed, or maybe an alternative to this?
I use eXist 2.2RC1 for this project.
I need to archive the contents of a collection (two .doc and a .vbs files) to a zip file using xQuery.
After some research, I found out about two functions that could help me out:
- compression:zip()
- response-stream-binary()
Now, the first function apparently enables us to zip either a set of entries or a collection to a zip file. I'm not sure if the second one is useful or not but since it enables us to specify the mimetype and the output name, I thought it might be.
The problem is that I can't seem to find how to indicate the target location of the output zip folder. As a result, the zip never gets created as a physical folder. I can display what seems to be the output stream using the response:stream binary() function but I actually have to store the zip file somewhere on the database.
This is what I've been doing so far:
Code: Select all
let $collection := "/db/apps/sample" (: path to the collection I want to zip :)
return (
compression:zip(xs:anyURI($collection), true()), (: just using compression:zip :)
response:stream-binary(compression:zip(xs:anyURI($collection), true()), "application/zip", "test.zip")(: using response:stream-binary and compression:zip :)
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Compress a collection to a zip folder
Hi,
You should consider finding an Exist users list and asking the question there. We do not use Exist that much internally so we are not familiar with all its XQuery capabilities.
Regards,
Radu
You should consider finding an Exist users list and asking the question there. We do not use Exist that much internally so we are not familiar with all its XQuery capabilities.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service