Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

List Zip file content with ZipFile

Avatar

Avatar
Springboard
MVP
Florian_Courgey
MVP

Likes

93 likes

Total Posts

87 posts

Correct Reply

19 solutions
Top badges earned
Springboard
Validate 1
Establish
Contributor
Ignite 1
View profile

Avatar
Springboard
MVP
Florian_Courgey
MVP

Likes

93 likes

Total Posts

87 posts

Correct Reply

19 solutions
Top badges earned
Springboard
Validate 1
Establish
Contributor
Ignite 1
View profile
Florian_Courgey
MVP

17-01-2019

Hi,

How to list the content of a ZIP file with ZipFile?

In the documentation, we can only extract a file if we know its name (see ZipFile.getEntry(name) in https://docs.campaign.adobe.com/doc/AC/en/jsapi/c-ZipFile.html ).

How can we list the files inside? Or extract the first file? We tried ZipFile.entries, ZipFile.getEntries(), ZipFile[0] with no luck

Example:

var zip = new ZipFile(vars.filename);

logInfo(zip); // [object ZipFile]

logInfo(zip.open()); // function open() { [native code] }

logInfo(zip); // [object ZipFile]

logInfo(JSON.stringify(zip)); // {}

for(var prop in zip){

  logInfo(prop, ':', zip[prop]); // fileCount : 1

}

logInfo(zip.getEntry('abc.zip')); // OK, but what if the file got an autogenerated timestapm

ZIP file:

2019-01-17_110455_screen_2.jpg

At the moment we're using linux commands but this is somewhat a hack:

execCommand('unzip -j '+vars.filename+' -d target_directory');

Thank you

Florian

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Establish
MVP
wodnicki
MVP

Likes

961 likes

Total Posts

1,090 posts

Correct Reply

509 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile

Avatar
Establish
MVP
wodnicki
MVP

Likes

961 likes

Total Posts

1,090 posts

Correct Reply

509 solutions
Top badges earned
Establish
Affirm 500
Contributor
Shape 1
Give Back 100
View profile
wodnicki
MVP

17-01-2019

I've always just used execCommand(). Interesting doc link, that forms section looks like something new.

Answers (0)