# gulp-gcloud

> Gulp task to publish to Google Clod Storage

Latest version **3.0.2** (published 2017-08-25) · Unlicense license · 0 weekly downloads

## Install

```sh
npm install gulp-gcloud
pnpm add gulp-gcloud
yarn add gulp-gcloud
bun add gulp-gcloud
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.2 |
| Published | 2017-08-25 |
| First published | 2016-04-08 |
| Weekly downloads | 0 |
| License | Unlicense |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Alberto Restifo |
| Maintainers | avvs |
| Keywords | gcloud, google, cloud, storage, google, cloud, gulpplugin |

## Links

- npm: https://www.npmjs.com/package/gulp-gcloud
- Repository: https://github.comAVVS/gulp-gcloud-publish
- Homepage: https://github.com/AVVS/gulp-gcloud-publish#readme
- Issues: https://github.com/AVVS/gulp-gcloud-publish/issues
- npm.io page: https://npm.io/package/gulp-gcloud

## Dependencies (6)

- [mime](https://npm.io/package/mime.md) ^1.3.4
- [pump](https://npm.io/package/pump.md) ^1.0.1
- [through2](https://npm.io/package/through2.md) ^2.0.0
- [gulp-util](https://npm.io/package/gulp-util.md) ^3.0.5
- [lodash.omit](https://npm.io/package/lodash.omit.md) ^4.5.0
- [@google-cloud/storage](https://npm.io/package/@google-cloud/storage.md) ^1.2.1

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 3.0.2 (latest) — 2017-08-25
- 3.0.1 — 2017-08-25
- 3.0.0 — 2017-08-25
- 2.2.0 — 2016-04-09
- 2.1.1 — 2016-04-08
- 2.1.0 — 2016-04-08
- 2.0.1 — 2016-04-08
- 2.0.0 — 2016-04-08

## README

# gulp-gcloud

Upload files to Google Cloud Storage with Gulp

## Install

```
npm install --save-dev gulp-gcloud
```

## Usage

First, you need to create your Google Cloud API credentials. [__Official Docs__][gc-docs].

The plugin takes a configuration object with the following keys:

- bucket `String`: Name of the bucket where we want to upload the file
- keyFilename `String`: Full path to the Google Cloud API keyfile ([docs][gc-docs])
- credentials `Object`: Full path to the Google Cloud API keyfile ([docs][gc-docs])
- projectId `String`: Google Cloud Project ID ([docs][gc-docs])
- base `String`: base path to use in the bucket, default to `/`
- public `Boolean` (optional): If set to true, marks the uploaded file as public
- transformPath `Function` (optional): pass function to transform upload path if base is not enough
- metadata `Object` (optional): specify extra metadata for files
- metadata.cacheControl `String` (optional): cache for 1 year, dont change assets, cache on intermediary proxies `max-age=315360000, no-transform, public`

## Example

If you would like to `gzip` the files, the plugin works best with [gulp-gzip](https://www.npmjs.com/package/gulp-gzip).

```js
const gulp = require('gulp');
const gcPub = require('gulp-gcloud');
const gzip = require('gulp-gzip'); // optional

gulp.task('publish', function() {
  return gulp.src('public/css/example.css')
    .pipe(gzip()) // optional
    .pipe(gcPub({
      bucket: 'bucket-name',
      keyFilename: 'path/to/keyFile.json',
      projectId: 'my-project-id',
      base: '/css',
      public: true,
      metadata: {
        cacheControl: 'max-age=315360000, no-transform, public',
      },
    })); // => File will be uploaded to /bucket-name/css/example.css
});
```

[gc-docs]: https://googlecloudplatform.github.io/gcloud-node/#/authorization

---
_Source: https://npm.io/package/gulp-gcloud · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
