{"id":22123355,"url":"https://github.com/drpaulbrewer/zip-bucket","last_synced_at":"2025-07-25T15:31:14.570Z","repository":{"id":19546288,"uuid":"87300268","full_name":"DrPaulBrewer/zip-bucket","owner":"DrPaulBrewer","description":"zips files in a Google Cloud Storage [tm] bucket","archived":false,"fork":false,"pushed_at":"2024-03-05T02:14:29.000Z","size":547,"stargazers_count":36,"open_issues_count":5,"forks_count":16,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-14T09:52:02.946Z","etag":null,"topics":["compression","google-cloud-storage","nodejs","zip"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DrPaulBrewer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2017-04-05T11:11:12.000Z","updated_at":"2024-03-26T15:10:20.000Z","dependencies_parsed_at":"2024-03-05T03:28:45.086Z","dependency_job_id":"bf919364-a3ac-4004-a5d2-6c997d336aa0","html_url":"https://github.com/DrPaulBrewer/zip-bucket","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrPaulBrewer%2Fzip-bucket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrPaulBrewer%2Fzip-bucket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrPaulBrewer%2Fzip-bucket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrPaulBrewer%2Fzip-bucket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DrPaulBrewer","download_url":"https://codeload.github.com/DrPaulBrewer/zip-bucket/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227586156,"owners_count":17789988,"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":["compression","google-cloud-storage","nodejs","zip"],"created_at":"2024-12-01T15:32:35.615Z","updated_at":"2024-12-01T15:32:36.257Z","avatar_url":"https://github.com/DrPaulBrewer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zip-bucket\n\n![Build Status](https://github.com/DrPaulBrewer/zip-bucket/actions/workflows/node.js.yml/badge.svg)\n[![Known Vulnerabilities](https://snyk.io/test/github/DrPaulBrewer/zip-bucket/badge.svg)](https://snyk.io/test/github/DrPaulBrewer/zip-bucket)\n\nCreates a .zip archive from a collection of files in a Google Cloud Storage[tm] bucket.  Include nodejs library and simple command-line program.\n\nKeep the resulting .zip file locally, upload back to Google Cloud Storage, or both.\n\n## Command Line Program\n\nThe `zip-bucket` command line program was split off\ninto its own module in v2.0.0.  \n\ninstall [zip-bucket-bin](https://npmjs.com/zip-bucket-bin) for the `zip-bucket` command line program\n\n## Library\n\nThe v2.0.0 library is the same as v1.9.0.  The only breaking change\nis the removal of the  `zip-bucket` command line program and associated dependencies.\n\n### Installation\n\n    npm i zip-bucket -S\n\n### Importing and Setup\n\n    const storage = require('@google-cloud/storage')(optional_api_key);\n\n**Pass the storage object** when setting up zipBucket for usage.\n\n    const zipBucket = require('zip-bucket')(storage);\n\n### Usage\n\nzipBucket takes an object with specific properties describing the zip operation, and returns a `Promise`\n\n    zipBucket({ fromBucket, fromPath, toBucket, toPath, keep, mapper, metadata })\n    .then(function yourNextTask({fromBucket, fromPath, toBucket, toPath, keep, metadata, manifest}))\n    ...\n\n### Object Parameters\n\n`fromBucket` **required** string - The name of the bucket in Google Cloud Storage[tm] to search for files to zip.  Does *not* need to begin with 'gs://'.  Example:  `\"my-favorite-bucket\"`\n\n`fromPath` **required** string - All files whose names begin with `fromPath` will be selected for adding to the zip file.\nExample: `\"blogposts/2017/Feb/\"`\n\n`toBucket` optional string - The name of the bucket where the zip file is to be stored.  This can be the same string used to set fromBucket.  If undefined, the zip file will not be uploaded to a bucket.  Example: `\"my-backup-bucket\"`\n\n`toPath` optional string - The path in the bucket to store the zip file, including the file name. Example: `\"2017/Feb/blogposts.zip\"`\n\n`keep` optional string - A path in the local filesystem to save the zip file.\n\n`metadata` optional object - A key/value object to set custom metadata for your zipfile in Google Cloud Storage.\n\n`mapper` optional function - A `function(GCS_File, fromPath):string` for renaming files inside the zip.  Could also be useful for generating side-effects, like populating metadata, or recording md5 values, etc. Has access to the full File object\nin Google Cloud Storage, including metadata, but not file contents. This function can be safely left undefined.\n\n### Promise resolution\n\nThe Promise will only resolve successfully if all steps pass, the zip file is created, and is [optionally] uploaded\nto the bucket and [optionally] saved.  \n\nThe Promise resolves to an object containing the properties shown in the call to `yourNextTask`, which is shown for illustrative purposes only.  Except for `manifest`, these are input properties passed as-is.\n\nTHe returned `manifest` consists of an array of pairs of the file name in the bucket and file name in the zip file, i.e. `[[fileNameInBucket, fileNameInZipfile],...]`\n\n### No bucket files are moved or deleted by zipBucket\n\n`zipBucket` does not delete the files from the bucket after copying them to the `.zip` archive. That's your job. The resolved `manifest` may be helpful.\n\n## Limitations\n\nThe current tests include a 100MB file and several smaller files. Streaming is used, and the write stream to \nGoogle Cloud Storage can sometimes timeout (~1%). This and other issues can be caught with the Promise's `.catch`.\n\n## Google Cloud Charges\n\nKeep in mind that running this software outside of Google Cloud will result in bandwidth fees. To save money,\nyou should probably find a way to run it from within Google Cloud.\n\nNote:  All Google service fees are your responsibility, as the user of this software, and under the MIT License there is\na disclaimer of liability for any defects in this software.\n\n## Local Testing\n\nIf you clone the repository and want to test it locally, you will need to change the storage initialization and\nbucket names in ./test/index.js to something more appropriate for your local tests.  \n\n## Copyright\n\nCopyright 2017 Paul Brewer, Economic and Financial Technology Consulting LLC \u003cdrpaulbrewer@eaftc.com\u003e and Contributors\n\n## Contributions\n\n@atlanteh Windows compatibility, downloadValidation flag, v1.0 based on streaming\n\n@harscoet Patch for issue with bin.js, move bin.js dependencies to \"dependencies\"\n\n## License\n\nThe MIT License\n\n### Trademarks\n\nGoogle Cloud Storage[tm] is a trademark of Google, Inc.\n\nThis software is not a product of Google, Inc.\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrpaulbrewer%2Fzip-bucket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrpaulbrewer%2Fzip-bucket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrpaulbrewer%2Fzip-bucket/lists"}