我想创建一个将由低功耗 cpu 解压缩的 zip 文件
Deflate 压缩会减小文件大小,但会增加解压缩时间。
zip 命令本身似乎对压缩是否值得进行了一些分析。请注意,对于某些文件,store
使用 (no-compression),而对于其他文件,使用deflate
(compression)。
当我分析输出时,我发现大约 25% 的文件压缩率小于 10%。假设这个轻微压缩的文件需要大量的 cpu 时间来解压缩,这对我来说是不值得的。
我可以告诉zip
它只deflate
用于至少可以压缩 20% 的文件吗?
我正在使用zip
与 Mac 捆绑在一起的命令。如果需要,愿意安装额外的免费软件。
$ zip -v
Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
This is Zip 3.0 (July 5th 2008), by Info-ZIP.
$ zip -FSr GravityExpress.pdx.zip ./GravityExpress.pd
adding: GravityExpress.pdx/ (stored 0%)
adding: GravityExpress.pdx/music/ (stored 0%)
adding: GravityExpress.pdx/music/StrangeStuff.mp3 (deflated 2%)
adding: GravityExpress.pdx/music/Escape_Gravity_Express.mp3 (deflated 2%)
adding: GravityExpress.pdx/music/SmoothAndCool.mp3 (deflated 2%)
adding: GravityExpress.pdx/music/scifiNights.mp3 (deflated 2%)
adding: GravityExpress.pdx/music/HomeStretch.mp3 (deflated 2%)
adding: GravityExpress.pdx/music/UpBeat.mp3 (deflated 2%)
adding: GravityExpress.pdx/music/AUTO.mp3 (deflated 2%)
adding: GravityExpress.pdx/music/the-countdown.mp3 (deflated 2%)
adding: GravityExpress.pdx/SystemAssets/ (stored 0%)
adding: GravityExpress.pdx/SystemAssets/card.pdi (stored 0%)
adding: GravityExpress.pdx/SystemAssets/wrapping-pattern.pdi (stored 0%)
adding: GravityExpress.pdx/SystemAssets/launchImage.pdi (stored 0%)
adding: GravityExpress.pdx/SystemAssets/card-pressed.pdi (stored 0%)
adding: GravityExpress.pdx/SystemAssets/launchImages/ (stored 0%)
adding: GravityExpress.pdx/SystemAssets/launchImages/9.pdi (stored 0%)
adding: GravityExpress.pdx/SystemAssets/launchImages/8.pdi (stored 0%)
adding: GravityExpress.pdx/SystemAssets/launchImages/10.pdi (stored 0%)
adding: GravityExpress.pdx/SystemAssets/launchImages/5.pdi (stored 0%)
adding: GravityExpress.pdx/SystemAssets/launchImages/4.pdi (stored 0%)
adding: GravityExpress.pdx/SystemAssets/launchImages/6.pdi (stored 0%)
adding: GravityExpress.pdx/SystemAssets/launchImages/7.pdi (stored 0%)
adding: GravityExpress.pdx/SystemAssets/launchImages/3.pdi (stored 0%)
adding: GravityExpress.pdx/SystemAssets/launchImages/2.pdi (stored 0%)
adding: GravityExpress.pdx/SystemAssets/launchImages/1.pdi (stored 0%)
adding: GravityExpress.pdx/video/ (stored 0%)
adding: GravityExpress.pdx/video/director_impact_imminent_2.json (deflated 15%)
adding: GravityExpress.pdx/video/congratulations.mp3 (deflated 2%)
adding: GravityExpress.pdx/video/director_other_way_2.mp3 (deflated 3%)
adding: GravityExpress.pdx/video/director_intro_2.mp3 (deflated 3%)
adding: GravityExpress.pdx/video/director_t_minus_ten.pdv (deflated 1%)
adding: GravityExpress.pdx/video/orientation.pdv (deflated 0%)
adding: GravityExpress.pdx/video/director_airlock_clear_2.pdv (deflated 1%)
adding: GravityExpress.pdx/video/director_open_airlock_3.mp3 (deflated 3%)
adding: GravityExpress.pdx/video/director_airlock_clear_2.json (deflated 37%)
adding: GravityExpress.pdx/video/director_open_airlock_3.json (deflated 47%)
adding: GravityExpress.pdx/video/director_impact_imminent_2.mp3 (deflated 3%)
adding: GravityExpress.pdx/video/director_intro_2.pdv (deflated 1%)
adding: GravityExpress.pdx/video/director_other_way_2.pdv (deflated 1%)
adding: GravityExpress.pdx/video/congratulations.pdv (deflated 0%)
adding: GravityExpress.pdx/video/director_impact_imminent_2.pdv (deflated 1%)
adding: GravityExpress.pdx/video/director_open_airlock_3.pdv (deflated 1%)
adding: GravityExpress.pdx/video/director_airlock_clear_2.mp3 (deflated 3%)
adding: GravityExpress.pdx/video/orientation.mp3 (deflated 2%)
adding: GravityExpress.pdx/video/director_t_minus_ten.mp3 (deflated 4%)
adding: GravityExpress.pdx/video/director_intro_2.json (deflated 47%)
adding: GravityExpress.pdx/video/director_t_minus_ten.json (stored 0%)
adding: GravityExpress.pdx/video/congratulations.json (deflated 45%)
adding: GravityExpress.pdx/video/director_other_way_2.json (deflated 15%)
adding: GravityExpress.pdx/video/orientation.json (deflated 52%)
adding: GravityExpress.pdx/main.pdz (deflated 0%)
adding: GravityExpress.pdx/images/ (stored 0%)
adding: GravityExpress.pdx/images/sprite_playdate.pdi (deflated 1%)
adding: GravityExpress.pdx/images/credits-qr.pdi (stored 0%)
adding: GravityExpress.pdx/images/launch_control_crank.pdt (stored 0%)
adding: GravityExpress.pdx/images/card_info_icon.pdi (deflated 7%)
adding: GravityExpress.pdx/images/checkpoint_banner.pdi (stored 0%)
adding: GravityExpress.pdx/images/rocket_ship_burn_start.pdt (stored 0%)
adding: GravityExpress.pdx/images/start_background.pdi (stored 0%)
adding: GravityExpress.pdx/images/launch_control_button.pdt (stored 0%)
adding: GravityExpress.pdx/images/logo.pdi (stored 0%)
adding: GravityExpress.pdx/images/level_thumbs.pdt (stored 0%)
adding: GravityExpress.pdx/images/rocket_ship_burn.pdt (stored 0%)
adding: GravityExpress.pdx/images/asteroid_surface.pdi (stored 0%)
adding: GravityExpress.pdx/images/rocket_ship.pdi (stored 0%)
adding: GravityExpress.pdx/images/sprite_classic.pdi (stored 0%)
adding: GravityExpress.pdx/images/launch_tower.pdi (stored 0%)
adding: GravityExpress.pdx/images/bricks_playdate.pdi (stored 0%)
adding: GravityExpress.pdx/images/launch_control_room.pdi (deflated 0%)
adding: GravityExpress.pdx/images/tooltips/ (stored 0%)
adding: GravityExpress.pdx/images/tooltips/tooltips.pdt (deflated 5%)
adding: GravityExpress.pdx/images/launch_control_battery_monitor.pdi (stored 0%)
adding: GravityExpress.pdx/images/bricks_classic.pdi (stored 0%)
adding: GravityExpress.pdx/images/level-select/ (stored 0%)
adding: GravityExpress.pdx/images/level-select/connector.pdi (deflated 6%)
adding: GravityExpress.pdx/images/level-select/a_button.pdt (stored 0%)
adding: GravityExpress.pdx/images/level-select/d_pad.pdt (stored 0%)
adding: GravityExpress.pdx/images/level-select/console.pdi (stored 0%)
adding: GravityExpress.pdx/images/level-select/challenge_bg.pdi (stored 0%)
adding: GravityExpress.pdx/images/level-select/large_challenge_icons.pdt (stored 0%)
adding: GravityExpress.pdx/lua/ (stored 0%)
adding: GravityExpress.pdx/lua/settings/ (stored 0%)
adding: GravityExpress.pdx/lua/settings/SettingsViewModel.pdz (stored 0%)
adding: GravityExpress.pdx/lua/settings/SettingsScreen.pdz (stored 0%)
adding: GravityExpress.pdx/lua/settings/Options.pdz (stored 0%)
adding: GravityExpress.pdx/lua/gameView.pdz (stored 0%)
adding: GravityExpress.pdx/lua/bricksView.pdz (stored 0%)
adding: GravityExpress.pdx/lua/input/ (stored 0%)
adding: GravityExpress.pdx/lua/gameViewModel.pdz (deflated 1%)
adding: GravityExpress.pdx/lua/gameInputs.pdz (stored 0%)
adding: GravityExpress.pdx/lua/start/ (stored 0%)
adding: GravityExpress.pdx/lua/start/startView.pdz (stored 0%)
adding: GravityExpress.pdx/lua/start/startScreen.pdz (stored 0%)
adding: GravityExpress.pdx/lua/start/startViewModel.pdz (stored 0%)
adding: GravityExpress.pdx/lua/game-explosion/ (stored 0%)
adding: GravityExpress.pdx/lua/game-explosion/GameExplosion.pdz (stored 0%)
adding: GravityExpress.pdx/lua/game-explosion/GameExplosionScreen.pdz (stored 0%)
adding: GravityExpress.pdx/lua/CamController.pdz (stored 0%)
adding: GravityExpress.pdx/lua/drawUtil.pdz (stored 0%)
adding: GravityExpress.pdx/lua/unittests.pdz (stored 0%)
adding: GravityExpress.pdx/lua/specialsViewModel.pdz (deflated 0%)
adding: GravityExpress.pdx/lua/common/ (stored 0%)
adding: GravityExpress.pdx/lua/common/PlanePhysicsViewModel.pdz (stored 0%)
adding: GravityExpress.pdx/lua/common/tooltip.pdz (stored 0%)
adding: GravityExpress.pdx/lua/gameScreen.pdz (deflated 0%)
adding: GravityExpress.pdx/lua/game-over/ (stored 0%)
adding: GravityExpress.pdx/lua/game-over/GameOverView.pdz (stored 0%)
adding: GravityExpress.pdx/lua/game-over/GameOverScreen.pdz (stored 0%)
adding: GravityExpress.pdx/lua/game-over/GameOverViewModel.pdz (stored 0%)
adding: GravityExpress.pdx/lua/gameHUD.pdz (stored 0%)
adding: GravityExpress.pdx/lua/video-player/ (stored 0%)
adding: GravityExpress.pdx/lua/video-player/VideoPlayerView.pdz (stored 0%)
adding: GravityExpress.pdx/lua/video-player/VideoTimebase.pdz (stored 0%)
adding: GravityExpress.pdx/lua/video-player/VideoPlayerScreen.pdz (deflated 1%)
adding: GravityExpress.pdx/lua/video-player/VideoViewModel.pdz (stored 0%)
adding: GravityExpress.pdx/lua/video-player/VideoPlayerViewModel.pdz (stored 0%)
adding: GravityExpress.pdx/lua/credits/ (stored 0%)
adding: GravityExpress.pdx/lua/credits/CreditsScreen.pdz (deflated 0%)
adding: GravityExpress.pdx/lua/credits/Credits.pdz (stored 0%)
adding: GravityExpress.pdx/lua/credits/CreditsViewModel.pdz (stored 0%)
adding: GravityExpress.pdx/lua/credits/CreditsView.pdz (stored 0%)
adding: GravityExpress.pdx/lua/end-game/ (stored 0%)
adding: GravityExpress.pdx/lua/end-game/EndGameViewModel.pdz (deflated 1%)
adding: GravityExpress.pdx/lua/end-game/FlyToCreditsView.pdz (stored 0%)
adding: GravityExpress.pdx/lua/end-game/FlyToCreditsScreen.pdz (deflated 2%)
adding: GravityExpress.pdx/lua/end-game/EndGameView.pdz (stored 0%)
adding: GravityExpress.pdx/lua/end-game/FlyToCreditsViewModel.pdz (deflated 1%)
adding: GravityExpress.pdx/lua/end-game/EndGameScreen.pdz (deflated 1%)
adding: GravityExpress.pdx/lua/specialsView.pdz (stored 0%)
adding: GravityExpress.pdx/lua/level-select/ (stored 0%)
adding: GravityExpress.pdx/lua/level-select/levelSelectView.pdz (stored 0%)
adding: GravityExpress.pdx/lua/level-select/levelSelectScreen.pdz (deflated 0%)
adding: GravityExpress.pdx/lua/level-select/lockAnimation.pdz (stored 0%)
adding: GravityExpress.pdx/lua/level-select/levelSelectViewModel.pdz (stored 0%)
adding: GravityExpress.pdx/libs/ (stored 0%)
adding: GravityExpress.pdx/sounds/ (stored 0%)
adding: GravityExpress.pdx/sounds/pickup.pda (deflated 17%)
adding: GravityExpress.pdx/sounds/thrust.pda (deflated 11%)
adding: GravityExpress.pdx/sounds/rocket_engine_loop.pda (deflated 81%)
adding: GravityExpress.pdx/sounds/barrier.pda (deflated 26%)
adding: GravityExpress.pdx/sounds/unlock_denied.pda (deflated 26%)
adding: GravityExpress.pdx/sounds/conveyor_belt.pda (deflated 11%)
adding: GravityExpress.pdx/sounds/key.pda (deflated 17%)
adding: GravityExpress.pdx/sounds/dump.pda (deflated 11%)
adding: GravityExpress.pdx/sounds/hollow-swish-airy-short.pda (deflated 11%)
adding: GravityExpress.pdx/sounds/extra_cargo.pda (deflated 8%)
adding: GravityExpress.pdx/sounds/classic/ (stored 0%)
adding: GravityExpress.pdx/sounds/classic/pickup.pda (deflated 18%)
adding: GravityExpress.pdx/sounds/classic/key.pda (deflated 17%)
adding: GravityExpress.pdx/sounds/classic/dump.pda (deflated 21%)
adding: GravityExpress.pdx/sounds/classic/extra.pda (deflated 12%)
adding: GravityExpress.pdx/sounds/classic/fuel.pda (deflated 10%)
adding: GravityExpress.pdx/sounds/fuel.pda (deflated 11%)
adding: GravityExpress.pdx/sounds/electronic_hum.pda (deflated 52%)
adding: GravityExpress.pdx/sounds/hollow-swish-airy-short-reverse.pda (deflated 17%)
adding: GravityExpress.pdx/sounds/blower.pda (deflated 11%)
adding: GravityExpress.pdx/sounds/extra_turbo.pda (deflated 8%)
adding: GravityExpress.pdx/sounds/landing.pda (deflated 22%)
adding: GravityExpress.pdx/sounds/ui_cancel.pda (deflated 31%)
adding: GravityExpress.pdx/sounds/launch_control_click.pda (deflated 85%)
adding: GravityExpress.pdx/sounds/rocket_engine_stop.pda (deflated 12%)
adding: GravityExpress.pdx/sounds/unlock.pda (deflated 10%)
adding: GravityExpress.pdx/sounds/ui_confirm.pda (deflated 31%)
adding: GravityExpress.pdx/sounds/extra_life.pda (deflated 10%)
adding: GravityExpress.pdx/sounds/rocket_engine_start.pda (deflated 12%)
adding: GravityExpress.pdx/sounds/explosion.pda (deflated 18%)
adding: GravityExpress.pdx/pdxinfo (deflated 22%)
adding: GravityExpress.pdx/levels/ (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL22.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL23.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL09.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL21.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL20.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL08.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL24.pdz (deflated 2%)
adding: GravityExpress.pdx/levels/LEVEL18.pdz (deflated 0%)
adding: GravityExpress.pdx/levels/LEVEL19.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL25.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL20.bin (deflated 65%)
adding: GravityExpress.pdx/levels/LEVEL08.bin (deflated 60%)
adding: GravityExpress.pdx/levels/LEVEL01.pdv (deflated 9%)
adding: GravityExpress.pdx/levels/LEVEL15.pdv (deflated 6%)
adding: GravityExpress.pdx/levels/LEVEL14.pdv (deflated 6%)
adding: GravityExpress.pdx/levels/LEVEL09.bin (deflated 61%)
adding: GravityExpress.pdx/levels/LEVEL21.bin (deflated 60%)
adding: GravityExpress.pdx/levels/LEVEL23.bin (deflated 72%)
adding: GravityExpress.pdx/levels/LEVEL16.pdv (deflated 17%)
adding: GravityExpress.pdx/levels/LEVEL02.pdv (deflated 4%)
adding: GravityExpress.pdx/levels/LEVEL03.pdv (deflated 11%)
adding: GravityExpress.pdx/levels/LEVEL17.pdv (deflated 0%)
adding: GravityExpress.pdx/levels/LEVEL22.bin (deflated 63%)
adding: GravityExpress.pdx/levels/LEVEL13.pdv (deflated 4%)
adding: GravityExpress.pdx/levels/LEVEL07.pdv (deflated 36%)
adding: GravityExpress.pdx/levels/LEVEL06.pdv (deflated 38%)
adding: GravityExpress.pdx/levels/LEVEL12.pdv (deflated 2%)
adding: GravityExpress.pdx/levels/LEVEL19.bin (deflated 64%)
adding: GravityExpress.pdx/levels/LEVEL25.bin (deflated 61%)
adding: GravityExpress.pdx/levels/LEVEL04.pdv (deflated 19%)
adding: GravityExpress.pdx/levels/LEVEL10.pdv (deflated 4%)
adding: GravityExpress.pdx/levels/LEVEL11.pdv (deflated 9%)
adding: GravityExpress.pdx/levels/LEVEL05.pdv (deflated 22%)
adding: GravityExpress.pdx/levels/LEVEL24.bin (deflated 66%)
adding: GravityExpress.pdx/levels/LEVEL18.bin (deflated 62%)
adding: GravityExpress.pdx/levels/CREDITS.bin (deflated 56%)
adding: GravityExpress.pdx/levels/README.md (deflated 21%)
adding: GravityExpress.pdx/levels/LEVEL15.bin (deflated 55%)
adding: GravityExpress.pdx/levels/LEVEL01.bin (deflated 62%)
adding: GravityExpress.pdx/levels/LEVEL20.pdv (deflated 8%)
adding: GravityExpress.pdx/levels/LEVEL08.pdv (deflated 4%)
adding: GravityExpress.pdx/levels/LEVEL09.pdv (deflated 0%)
adding: GravityExpress.pdx/levels/LEVEL21.pdv (deflated 5%)
adding: GravityExpress.pdx/levels/LEVEL14.bin (deflated 64%)
adding: GravityExpress.pdx/levels/LEVEL02.bin (deflated 63%)
adding: GravityExpress.pdx/levels/LEVEL16.bin (deflated 61%)
adding: GravityExpress.pdx/levels/LEVEL23.pdv (deflated 18%)
adding: GravityExpress.pdx/levels/LEVEL22.pdv (deflated 0%)
adding: GravityExpress.pdx/levels/LEVEL17.bin (deflated 62%)
adding: GravityExpress.pdx/levels/LEVEL03.bin (deflated 66%)
adding: GravityExpress.pdx/levels/LEVEL07.bin (deflated 59%)
adding: GravityExpress.pdx/levels/LEVEL13.bin (deflated 59%)
adding: GravityExpress.pdx/levels/LEVEL12.bin (deflated 65%)
adding: GravityExpress.pdx/levels/LEVEL06.bin (deflated 87%)
adding: GravityExpress.pdx/levels/LEVEL10.bin (deflated 88%)
adding: GravityExpress.pdx/levels/LEVEL04.bin (deflated 68%)
adding: GravityExpress.pdx/levels/LEVEL19.pdv (deflated 1%)
adding: GravityExpress.pdx/levels/LEVEL25.pdv (deflated 4%)
adding: GravityExpress.pdx/levels/LEVEL24.pdv (deflated 1%)
adding: GravityExpress.pdx/levels/LEVEL18.pdv (deflated 3%)
adding: GravityExpress.pdx/levels/LEVEL05.bin (deflated 62%)
adding: GravityExpress.pdx/levels/LEVEL11.bin (deflated 61%)
adding: GravityExpress.pdx/levels/LEVEL17.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL03.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL02.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL16.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL14.pdz (stored 0%)
adding: GravityExpress.pdx/levels/CREDITS.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL15.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL01.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL05.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL11.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL10.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL04.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL12.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL06.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL07.pdz (stored 0%)
adding: GravityExpress.pdx/levels/LEVEL13.pdz (deflated 2%)
adding: GravityExpress.pdx/fonts/ (stored 0%)
adding: GravityExpress.pdx/fonts/digital-7-mono-20.pft (stored 0%)
adding: GravityExpress.pdx/fonts/Edit Undo/ (stored 0%)
adding: GravityExpress.pdx/fonts/Edit Undo/edit-undo.dot-brk-50.pft (stored 0%)
adding: GravityExpress.pdx/fonts/Roobert/ (stored 0%)
adding: GravityExpress.pdx/fonts/Roobert/Roobert-10-Bold.pft (stored 0%)
adding: GravityExpress.pdx/fonts/Roobert/Roobert-9-Mono-Condensed.pft (stored 0%)
adding: GravityExpress.pdx/fonts/abduction2002bold-20.pft (stored 0%)
根据手册页,“zip 会自动为每个要压缩的文件选择两者(压缩或存储...)中较好的一个。”
可以使用 -n 来指导行为以从压缩中排除某些文件后缀。在您的示例中,添加 -n .mp3:.json:.pdz 将使您接近。您可以更新 ZIPOPT 环境变量以自动执行此操作。
还有一个 -# 开关可以调节压缩速度。-0 表示不压缩,-1 表示最快(和最少)压缩。-9 是最慢的并且忽略后缀列表。默认值为 -6。
ZIP 是开源的,因此只需付出更多的努力,您就可以添加自己的行为。