Skip to content

Commit

Permalink
Merge pull request #51 from DrPaulBrewer/split-bin
Browse files Browse the repository at this point in the history
Split bin off into its own module
  • Loading branch information
DrPaulBrewer committed Aug 2, 2023
2 parents 5a65b2f + c16dddb commit 10e23dd
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 186 deletions.
85 changes: 6 additions & 79 deletions README.md
Expand Up @@ -2,96 +2,23 @@

![Build Status](https://github.com/DrPaulBrewer/zip-bucket/actions/workflows/node.js.yml/badge.svg)
[![Known Vulnerabilities](https://snyk.io/test/github/DrPaulBrewer/zip-bucket/badge.svg)](https://snyk.io/test/github/DrPaulBrewer/zip-bucket)
[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/DrPaulBrewer/zip-bucket.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/DrPaulBrewer/zip-bucket/context:javascript)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/DrPaulBrewer/zip-bucket.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/DrPaulBrewer/zip-bucket/alerts/)

Creates a .zip archive from a collection of files in a Google Cloud Storage[tm] bucket. Include nodejs library and simple command-line program.

Keep the resulting .zip file locally, upload back to Google Cloud Storage, or both.

## Command Line Program

### Installation

For global installation of the command line program, so that all users can use "zip-bucket":

sudo npm install -g zip-bucket

### Usage

Enter `zip-bucket --help` to print this reminder message:

<pre>

Usage: zip-bucket [options] fromBucketPath [toBucketPath]

Options:

-h, --help output usage information
-V, --version output the version number
--key <keyfile> keyfile to access Google Cloud Storage API
--keep <keep> path in local filesystem to keep a copy of the .zip file
--progress show progress messages
--json output parameters and manifest in json at program completion

</pre>

`<fromBucketPath>` has the format `gs://bucketName/path`

`<toBucketPath>` needs to include the zip file name, e.g. `gs://bucketName/some/other/path/myzipfile.zip`

### Examples

#### Example #1

Goal: zip up the files found at gs://my-bucket/2016 to another bucket gs://backup-bucket/my2016.zip, show progress messages (not shown)

$ zip-bucket --progress --key /path/to/secret/key.json gs://my-bucket/2016 gs://backup-bucket/my2016.zip

#### Example #2

Goal: zip up the files found at gs://my-bucket/20170402T0616/U to a local file /tmp/sims2.zip and output the manifest (and parameters) in JSON

$ zip-bucket --json --key /path/to/secret/key.json --keep /tmp/sims2.zip gs://my-bucket/20170402T0616/U/
{
"keep": "/tmp/sims2.zip",
"fromBucket": "my-bucket",
"fromPath": "20170402T0616/U/",
"manifest": [
[
"20170402T0616/U/effalloc.csv",
"U/effalloc.csv"
],
[
"20170402T0616/U/md5.json",
"U/md5.json"
],
[
"20170402T0616/U/ohlc.csv",
"U/ohlc.csv"
],
[
"20170402T0616/U/profit.csv",
"U/profit.csv"
],
[
"20170402T0616/U/sim.json",
"U/sim.json"
],
[
"20170402T0616/U/trade.csv",
"U/trade.csv"
],
[
"20170402T0616/U/volume.csv",
"U/volume.csv"
]
]
}
The `zip-bucket` command line program was split off
into its own module in v2.0.0.

install [zip-bucket-bin](https://npmjs.com/zip-bucket-bin) for the `zip-bucket` command line program

## Library

The v2.0.0 library is the same as v1.9.0. The only breaking change
is the removal of the `zip-bucket` command line program and associated dependencies.

### Installation

npm i zip-bucket -S
Expand Down
62 changes: 0 additions & 62 deletions bin.js

This file was deleted.

0 comments on commit 10e23dd

Please sign in to comment.