google-cloud-bucket
Advanced tools
Comparing version 0.13.0 to 0.13.1
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="0.13.1"></a> | ||
## [0.13.1](https://github.com/nicolasdao/google-cloud-bucket/compare/v0.13.0...v0.13.1) (2019-04-10) | ||
### Features | ||
* Add support for returning the number of files deleted when a bucket is deleted ([0856e08](https://github.com/nicolasdao/google-cloud-bucket/commit/0856e08)) | ||
<a name="0.13.0"></a> | ||
@@ -7,0 +17,0 @@ # [0.13.0](https://github.com/nicolasdao/google-cloud-bucket/compare/v0.12.5...v0.13.0) (2019-04-10) |
20
index.js
@@ -258,13 +258,15 @@ /** | ||
options = options || {} | ||
if (!options.force) | ||
return yield deleteBucket(bucket, options) | ||
if (!options.force) { | ||
const res = yield deleteBucket(bucket, options) | ||
return { count:0, data:res } | ||
} | ||
const files = (yield listObjects(bucket, '/', options)) || [] | ||
const l = files.length | ||
if (l == 0) | ||
return yield deleteBucket(bucket, options) | ||
const deleteTasks = files.map(({ name }) => (() => deleteObject(bucket, name, options))) | ||
yield throttle(deleteTasks, 20) | ||
return yield deleteBucket(bucket, options) | ||
const count = files.length | ||
if (count > 0) { | ||
const deleteTasks = files.map(({ name }) => (() => deleteObject(bucket, name, options))) | ||
yield throttle(deleteTasks, 20) | ||
} | ||
const data = yield deleteBucket(bucket, options) | ||
return { count, data } | ||
}) | ||
@@ -271,0 +273,0 @@ |
@@ -1,2 +0,2 @@ | ||
# Google Cloud Doc | ||
# Google Cloud Storgae Doc | ||
@@ -3,0 +3,0 @@ ## How To |
{ | ||
"name": "google-cloud-bucket", | ||
"version": "0.13.0", | ||
"version": "0.13.1", | ||
"description": "Nodejs package to add objects to a Google Cloud Bucket.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -498,2 +498,5 @@ # Google Cloud Bucket · [![NPM](https://img.shields.io/npm/v/google-cloud-bucket.svg?style=flat)](https://www.npmjs.com/package/google-cloud-bucket) [![Tests](https://travis-ci.org/nicolasdao/google-cloud-bucket.svg?branch=master)](https://travis-ci.org/nicolasdao/google-cloud-bucket) [![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](https://opensource.org/licenses/BSD-3-Clause) [![Neap](https://neap.co/img/made_by_neap.svg)](#this-is-what-we-re-up-to) | ||
- `force` `<Boolean>` Default is false. When false, deleting a non-empty bucket throws a 409 error. When set to true, even a non-empty bucket is deleted. Behind the scene, the entire content is deleted first. That's why forcing a bucket deletion might take longer. | ||
* Returns an object: | ||
- `count` `<Number>` The number of files deleted. This count number does not include the bucket itself (e.g., `0` means that the bucket was empty and was deleted successfully). | ||
- `data` `<Object>` Extra information about the deleted bucket. | ||
@@ -605,2 +608,4 @@ ### bucket.update(config,[options]): `<Promise<Object>>` | ||
* `options` `<Object>` | ||
* Returns an object: | ||
- `count` `<Number>` The number of files deleted. | ||
@@ -607,0 +612,0 @@ > NOTE: To delete a folder, the argument used to create the `bucketObject` must be a folder (e.g., `storage.bucket('your-bucket-id').object('folderA/folderB').delete()`) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
120186
1626
800