I'm having an issue with using zip.directory
in Windows.
This is the file structure I'm trying to create:
. ├── file1.txt ├── file2.txt └── file3.txt
file2.txt
and file3.txt
are coming from a directory called dir
.
Here is the code I have on my server:
const zip = archiver('zip')
zip.append('some text', { name: 'file1.txt' })
zip.directory('dir/', '.')
zip.finalize()
This works fine on Mac. However, using the '.'
to put everything in the same directory seems to not work on Windows (basically only file1.txt
makes it into the zip).
The following, however, DOES work:
const zip = archiver('zip')
zip.append('some text', { name: 'file1.txt' })
zip.directory('dir/', 'somename')
zip.finalize()
However, this gives a folder structure like this:
. ├── file1.txt └── somename ├── file2.txt └── file3.txt
which isn't really what I'm looking for. Is there a way around this?
via inhwrbp
No comments:
Post a Comment