node-archiver icon indicating copy to clipboard operation
node-archiver copied to clipboard

Update description about `file()`?

Open ve3 opened this issue 2 years ago • 0 comments

From your document about file(), here is current document.

Appends a file given its filepath using a lazystream wrapper to prevent issues with open file limits.

When the instance has received, processed, and emitted the file, the entry event is fired.

When I'm reading about it (as I am new here) I can not know that how to add empty folder from my list of files (and folders). Example: My list

[
    "D:/wwwroot/config",
    "D:/wwwroot/config/file.php",
]

First, I try to use directory() method but that one included everything that I was already excluded/ignored in the list - for example "D:/wwwroot/config/ignoreme.php".

My previous code:

const isDir = fs.lstatSync(fullPathSource).isDirectory();
if (isDir) {
    archive.directory(fullPathSource, item);
} else {
    archive.file(fullPathSource, {name: item});
}

So, that's why I just want something like addEmptyDir() in PHP
And I look for it and found no way to do it in directory() method.
...Until I use only .file() for everything (files & folders) then it is just working as expect.

Maybe update your document about file() that it works with type file and directory (folder) ?

Thank you.

ve3 avatar Jul 05 '22 10:07 ve3