{"id":13912445,"url":"https://github.com/nfriedly/node-bestzip","last_synced_at":"2025-04-05T02:12:30.019Z","repository":{"id":22535249,"uuid":"25875982","full_name":"nfriedly/node-bestzip","owner":"nfriedly","description":"Provides a `bestzip` command that uses the system `zip` if avaliable, and a Node.js implimentation otherwise.","archived":false,"fork":false,"pushed_at":"2024-08-28T21:12:27.000Z","size":771,"stargazers_count":84,"open_issues_count":16,"forks_count":17,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T01:14:02.416Z","etag":null,"topics":["bundle","compress","package","zip"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nfriedly.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-10-28T15:25:12.000Z","updated_at":"2025-02-20T03:46:24.000Z","dependencies_parsed_at":"2023-01-11T21:39:58.757Z","dependency_job_id":"e232cac7-e9ee-4937-b8f6-4222d61e45d7","html_url":"https://github.com/nfriedly/node-bestzip","commit_stats":{"total_commits":125,"total_committers":14,"mean_commits":8.928571428571429,"dds":"0.30400000000000005","last_synced_commit":"63e6109b8d7c92ee2aaba38aef146befadcd21f7"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfriedly%2Fnode-bestzip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfriedly%2Fnode-bestzip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfriedly%2Fnode-bestzip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nfriedly%2Fnode-bestzip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nfriedly","download_url":"https://codeload.github.com/nfriedly/node-bestzip/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247276189,"owners_count":20912288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bundle","compress","package","zip"],"created_at":"2024-08-07T01:01:28.158Z","updated_at":"2025-04-05T02:12:30.004Z","avatar_url":"https://github.com/nfriedly.png","language":"JavaScript","funding_links":[],"categories":["others"],"sub_categories":[],"readme":"# bestzip\n\n[![tests](https://github.com/nfriedly/node-bestzip/actions/workflows/ci.yml/badge.svg)](https://github.com/nfriedly/node-bestzip/actions/workflows/ci.yml)\n[![npm version](https://badge.fury.io/js/bestzip.svg)](https://www.npmjs.com/package/bestzip)\n[![npm downloads](https://img.shields.io/npm/dm/bestzip)](https://www.npmjs.com/package/bestzip)\n\nThis module provides a `bestzip` command that calls the native `zip` command if available and otherwise falls back to a\nNode.js implementation.\n\nThe `--recurse-directories` (`-r`) option is automatically enabled.\n\n## Why?\n\nThe native `zip` command on GNU/Linux and macOS is significantly faster and creates moderately smaller .zip files than the Node.js version included here, but Windows has no built-in `zip` command. This module provides the best of both worlds, and allows for easier cross-platform scripting.\n\n## Global command line usage\n\n    npm install -g bestzip\n    bestzip destination.zip source/ [other sources...]\n\n## Command line usage within `package.json` scripts\n\n    npm install --save-dev bestzip\n\npackage.json:\n\n```javascript\n{\n    //...\n    \"scripts\": {\n        \"build\" \"...\",\n        \"zip\": \"bestzip bundle.zip build/*\",\n        \"upload\": \"....\",\n        \"deploy\": \"npm run build \u0026\u0026 npm run zip \u0026\u0026 npm run upload\"\n    }\n}\n```\n\n## Programmatic usage from within Node.js\n\n```javascript\nvar zip = require('bestzip');\n\nzip({\n  source: 'build/*',\n  destination: './destination.zip'\n}).then(function() {\n  console.log('all done!');\n}).catch(function(err) {\n  console.error(err.stack);\n  process.exit(1);\n});\n\n// v1.x API also works for backwards compatibility: zip(destination, sources, callback)\n```\n\n### Options\n\n* `source`: Path or paths to files and folders to include in the zip file. String or Array of Strings.\n* `destination`: Path to generated .zip file.\n* `cwd`: Set the Current Working Directory that source and destination paths are relative to. Defaults to `process.cwd()`\n* `level`: Set the level of compression. (Number 0-9, with 0 being no compression and 9 being the most compressed.)\n\n## How to control the directory structure\n\nThe directory structure in the .zip is going to match your input files, but the exact details depend on how the command is called. For example:\n\n`bestzip build.zip build/*`\n\nThis includes the build/ folder inside of the .zip\n\nAlternatively:\n\n`cd build/ \u0026\u0026 bestzip ../build.zip *`\n\nThis will not include the build/ folder, it's contents will be top-level.\n\n*Note: some tools, including the Archive Utility built into macOS, will automatically create a top-level folder to group everything together when extracting a .zip archive that contains multiple top-level files.*\n\nWhen using the programmatic API, the same effect may be achieved by passing in the `cwd` option.\n\n## .dotfiles\n\nWildcards (`*`) ignore dotfiles.\n\n* To include a dotfile, either include the directory it's in (`folder/`) or include it by name (`folder/.dotfile)`\n* To omit dotfiles, either use a wildcard (`folder/*`) or explicitly list the desired files (`folder/file1.txt folder/file2.txt`)\n\n## Breaking changes for v2\n\n* `bestzip output.zip foo/bar/file.txt` now includes the foo/bar/ folders, previously it would place file.txt at the top-level\n  * This was done to more closely align with the native zip command\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfriedly%2Fnode-bestzip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnfriedly%2Fnode-bestzip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnfriedly%2Fnode-bestzip/lists"}