cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Streaming XML data to ZipFile Write - how to set internal filename

jcampion
New Contributor III

I would like to stream data directly to a zip file (without first writing the data to disk).
I want to dynamically set the name of the file inside the zip file (not the zip file, but the file it contains).
Given this file:
mydata.zip
myfile1.xml

I want to create mydata.zip file (which I can do and name properly), and name the internal xml file without first writing the xml to disk.

When I use the XML formatter, it creates output as output0, not as myfile1.xml.

If I read a file from disk, it correctly sets the file name, however if I use the XML formatter to create binary data to stream to the ZipFile Write component, I canโ€™t find a way to set XML filename.

Any suggestions are greatly appreciated.
Thanks,
Judy

6 REPLIES 6

del
Contributor III

@jcampion, I think youโ€™re almost there. With the ZipFile Write snap, make sure to check the Use input view label option. Then in the views tab, give the input view the name of the internal filename you would like.


43e0e32531e75da51028440f749b89a42ff2cf0e.png


0912be704a33d65f2f4d0e511e4b53fdaf87b75c.png

jcampion
New Contributor III

Thank you so much. It worked!

Rameeja
New Contributor

Hi ,

I want to save file like input.file but it is giving .file as type.
image

Thanks,
Rameeja

psadasivam
New Contributor III

@jcampion, Here is a way, if you want to set filename dynamically.

I am not sure about your pipeline design, But zip write always takes binary input. Place a mapper before document to binary snap and set โ€œ$[โ€˜content-locationโ€™]โ€ property with filename you want. thatโ€™s it ๐Ÿ™‚.

Design:

c98e58f45d153673c7b370719f373bfceafa1258.png

Output:
a87312a312c1869cbbcab3294999286f8ce88f06.png

hope this helps.