DanielHindi / aws-s3-zipper

takes an amazon s3 bucket folder and zips it for streaming or serializes to a file
119 stars 74 forks source link

zipToFileFragments: maxFileCount not produced results as expected? #46

Open MarkSkillen opened 3 years ago

MarkSkillen commented 3 years ago

Having read through the readme, I'm looking to utilise the "Zip fragments to local file system with the filename pattern with a maximum file count" process.

As per the directions, I'm using the maxFileCount parameter but I'm not seeing it produce the expected results.

E.g I have the following snippet:

zipper.zipToFileFragments ({ s3FolderName:'folder1' ,startKey: null ,zipFileName: './myLocalFile.zip' ,maxFileCount: 1 }, function(err,results){ if(err) console.error(err); else{ if(results.length > 0) { var result = results[results.length - 1]; var lastFile = result.zippedFiles[result.zippedFiles.length - 1]; if (lastFile) console.log('last key ', lastFile.Key); // next time start from here } } });

My S3 bucket folder contains 3 files, and I wanted to test this out to create 3 zips locally, with one file in each zip, however I always seem to get just one zip with all the files in it. I've tested this in other S3 buckets with more files and altered this maxFileCount value, but every run puts all files in one zip - I'd expect this to produce multiple zips each contain the number of files specified as above, again based off of the readme.

Could anyone please advise? Thanks in advance!