zip-lib icon indicating copy to clipboard operation
zip-lib copied to clipboard

Feature: include/exclude support zipping

Open Maescool opened this issue 1 year ago • 1 comments

I'd like it when creating zip's to have include,exclude options I created this in a feature branch https://github.com/Maescool/zip-lib/tree/feature/include_exclude

Is this ok to make a pull request for this? or do you want this implemented differently?

Maescool avatar Dec 27 '24 15:12 Maescool

Perhaps we could add an onEntry callback to IZipOptions, similar to the one in IExtractOptions. This would allow you to call preventDefault to exclude specific files or folders from being included in the archive.

export interface IZipOptions {
    /**
     * Indicates how to handle when the given path is a symbolic link.
     *
     * `true`: add the target of the symbolic link to the zip.
     *
     * `false`: add symbolic link itself to the zip.
     *
     * The default value is `false`.
     */
    followSymlinks?: boolean;
    /**
     * Sets the compression level.
     *
     * 0: the file data will be stored, otherwise, the file data will be deflated.
     *
     * The default value is `6`.
     */
    compressionLevel?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
    /**
     * Called before an item is achived.
     * @param event
     */
    onEntry?: (event: IEntryEvent) => void;
}

PR is welcome!

fpsqdb avatar Dec 28 '24 04:12 fpsqdb