NodeJS ZIP symlink and can't read them on Windows 10

237 views Asked by At

I'm using Archiver in a NodeJS environment (running on linux) to create a ZIP with a structure like this:

/root
    /documents
        /doc1.pdf
        /doc2.pdf
        /doc3.pdf
    /clientA
        /doc1.pdf < symlink to ../documents/doc1.pdf
    /clientB
        /doc3.pdf < symlink to ../documents/doc3.pdf

Using these functions of ArchiverJS:

archiverInstance.append(filestream, {name: '/root/documents/doc1.pdf'})

archiverInstance.symlink('/root/clientA/doc1.pdf', '../documents/doc1.pdf')

When I download this ZIP on linux, I can open the symlinks.

# linux ubuntu 19.04
ls -l ~/root/clientA
lrwxrwxrwx 1 usr usr 28 oct 11 11:51 doc1.pdf -> ../documents/doc1.pdf`

But when I download this ZIP on Windows 10, symlinks are broken, using the standard "Extract" button from the windows explorer.

# windows 10
cd root/clientA
dir
10/11/2019  02:49 AM  <DIR>     .
10/11/2019  02:49 AM  <DIR>     ..
10/11/2019  02:49            28 doc1.pdf < click on it = PDF corrupted
               1 File(s)      28 bytes
               2 Dir(s)

Why this does not work on Windows 10? And is there an alternative to make it work?

Thanks

0

There are 0 answers