cross-zip-cli icon indicating copy to clipboard operation
cross-zip-cli copied to clipboard

When zipping a directory, the zip file is always created in its parent directory regardless of the desired path

Open jsepia opened this issue 8 years ago • 2 comments

Sample package.json:

{
  "name": "zip-test",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "cross-zip ./parent/child/grandchild output.zip"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "cross-zip-cli": "^1.0.0"
  }
}

Make a nested directory structure:

mkdir -p parent/child/grandchild
echo "foo" > parent/child/grandchild/data.txt

Run the script:

$ npm run test

> [email protected] test /Users/sepiaj/ws/zip-test
> cross-zip ./parent/child/grandchild ./output.zip

Expected result: The zip file appears in the CWD (or in this case, the root of the project), as a sibling to package.json.

Actual result: The zip file shows up in parent/child/.

jsepia avatar Jan 15 '17 23:01 jsepia

Thanks for reporting. IRC... this may be a platform limitation. You'll want to dig in https://github.com/feross/cross-zip to find out more.

jprichardson avatar Jan 16 '17 03:01 jprichardson

@jsepia, what platform are you running on? Placing the output file in a separate single subdirectory is working for me on Windows 10, e.g.

cross-zip source target/foobar.zip

garretwilson avatar Sep 09 '18 17:09 garretwilson