Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support globs in upload #412

Closed
raitucarp opened this issue Feb 24, 2015 · 6 comments
Closed

support globs in upload #412

raitucarp opened this issue Feb 24, 2015 · 6 comments
Assignees
Labels
api: storage Issues related to the Cloud Storage API. 🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@raitucarp
Copy link

I have error Error: EISDIR

Is it relevance with upload folder features?
Can I request that feature? if not, could you explain me why?

Thanks

@ryanseys ryanseys added enhancement api: storage Issues related to the Cloud Storage API. labels Feb 24, 2015
@ryanseys ryanseys added this to the Storage Future milestone Feb 24, 2015
@ryanseys
Copy link
Contributor

Thanks for your suggestion! I believe we may be able to support such a feature. Something like this might be sufficient:

var opts = { recursive: true, validation: true, resumable: true };
bucket.uploadFolder('./photos', opts, function(errs, files) {
  // errs is null if no errors occur on any files
  // errs is array of errors for every file that fails to upload
  // files is every file that succeeds in uploading
});

The only issue I can see with this is that it will be hard to measure progress of such uploads (which could be long running) without any sort of stream interface. We might be able to do some sort of "progress stream" like:

var progress = bucket.uploadFolder(/* ... */);
progress.on('error', errCallback);
progress.on('fileEnd', aSingleFileDoneCallback);
progress.on('end', allFilesDoneCallback);

Until then you could probably get by with something like this which should in theory upload all files in a particular folder (non-recursively):

var fs = require('fs');
var async = require('async'); // npm install async
var bucket = storage.bucket('my-bucket'); // need to inititialize storage beforehand (see docs)
var contents = fs.readdirSync('./path/to/folder'); // get contents of folder (files and folders)
var files = contents.filter(function(file) {
  return fs.statSync(file).isFile(); // filter out only files
});
async.each(files, function(file, cb) {
  bucket.upload(file, cb);
}, function(err) {
  // all files should be uploaded now assuming there were no errors!
});

@stephenplusplus
Copy link
Contributor

I don't mind the idea, though we would just be doing what the user could do in their code (1. get a list of files in a directory, 2. send each file to bucket.upload).

To handle this more easily, we could support glob input to allow more specificity: bucket.upload("backups/*.jpg", ...

@stephenplusplus
Copy link
Contributor

The only issue I can see with this is that it will be hard to measure progress of such uploads (which could be long running) without any sort of stream interface.

That example looks good to me, though I would nit-pickingly change fileEnd to file-uploaded.

@ryanseys
Copy link
Contributor

Yeah, sure! That was just an example 😃 If it happened that way we might decide to have more events too.

@raitucarp
Copy link
Author

OK. @stephenplusplus I catch the clue. Thanks for such suggestion 👍

@stephenplusplus stephenplusplus changed the title Add support to upload folder? support globs in upload Mar 31, 2015
@stephenplusplus
Copy link
Contributor

I got it in my head that supporting globs would be a good idea, but after an attempt at an implementation, it felt like more weight than our library should handle. If anyone objects, feel free to discuss!

@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Apr 6, 2020
chingor13 pushed a commit that referenced this issue Aug 22, 2022
PiperOrigin-RevId: 339708980

Source-Author: Google APIs <noreply@google.com>
Source-Date: Thu Oct 29 11:23:44 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 00bbad4dfd6633cf4b5f9596c1f93b756bb5c776
Source-Link: googleapis/googleapis@00bbad4
sofisl pushed a commit that referenced this issue Sep 15, 2022
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/cc99acfa-05b8-434b-9500-2f6faf2eaa02/targets

- [ ] To automatically regenerate this PR, check this box.

Source-Link: googleapis/synthtool@799d8e6
sofisl pushed a commit that referenced this issue Sep 16, 2022
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/a27e585a-8362-450e-a458-6225be320237/targets

- [ ] To automatically regenerate this PR, check this box.

PiperOrigin-RevId: 361273630
Source-Link: googleapis/googleapis@5477122
sofisl pushed a commit that referenced this issue Sep 27, 2022
* Change triggered by none of the following:
This git repo (https://github.com/googleapis/nodejs-video-intelligence.git)
Git repo https://github.com/googleapis/googleapis.git
Git repo https://github.com/googleapis/synthtool.git

* docs: document the release schedule we follow (#454)
googleapis/synthtool@6a17abc
commit 6a17abc7652e2fe563e1288c6e8c23fc260dda97
Author: Benjamin E. Coe <bencoe@google.com>
Date:   Mon Mar 23 19:22:34 2020 -0700

    docs: document the release schedule we follow (#454)

synthtool/gcp/templates/node_library/README.md
sofisl pushed a commit that referenced this issue Oct 5, 2022
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/a27e585a-8362-450e-a458-6225be320237/targets

- [ ] To automatically regenerate this PR, check this box.

PiperOrigin-RevId: 361273630
Source-Link: googleapis/googleapis@5477122
sofisl pushed a commit that referenced this issue Oct 5, 2022
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/a27e585a-8362-450e-a458-6225be320237/targets

- [ ] To automatically regenerate this PR, check this box.

PiperOrigin-RevId: 361273630
Source-Link: googleapis/googleapis@5477122
sofisl pushed a commit that referenced this issue Oct 8, 2022
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/a27e585a-8362-450e-a458-6225be320237/targets

- [ ] To automatically regenerate this PR, check this box.

PiperOrigin-RevId: 361273630
Source-Link: googleapis/googleapis@5477122
sofisl pushed a commit that referenced this issue Oct 12, 2022
* docs: fix docstring formatting

Committer: @parthea
PiperOrigin-RevId: 409547707

Source-Link: googleapis/googleapis@45a2c07

Source-Link: googleapis/googleapis-gen@99869d7
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOTk4NjlkN2FiZmZiNzc5MWEwN2IyMTRlYTNjNWYyY2MwMDNlYzBiMCJ9

* 🦉 Updates from OwlBot

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
sofisl pushed a commit that referenced this issue Oct 13, 2022
* chore(main): release 3.0.4

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
sofisl pushed a commit that referenced this issue Nov 9, 2022
* Change triggered by none of the following:
This git repo (https://github.com/googleapis/nodejs-video-intelligence.git)
Git repo https://github.com/googleapis/googleapis.git
Git repo https://github.com/googleapis/synthtool.git

* docs: document the release schedule we follow (#454)
googleapis/synthtool@6a17abc
commit 6a17abc7652e2fe563e1288c6e8c23fc260dda97
Author: Benjamin E. Coe <bencoe@google.com>
Date:   Mon Mar 23 19:22:34 2020 -0700

    docs: document the release schedule we follow (#454)

synthtool/gcp/templates/node_library/README.md
sofisl pushed a commit that referenced this issue Nov 10, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [mocha](https://mochajs.org/) ([source](https://github.com/mochajs/mocha)) | devDependencies | major | [`^7.0.0` -> `^8.0.0`](https://renovatebot.com/diffs/npm/mocha/7.2.0/8.0.1) |

---

### Release Notes

<details>
<summary>mochajs/mocha</summary>

### [`v8.0.1`](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md#&#8203;801--2020-06-10)

[Compare Source](https://github.com/mochajs/mocha/compare/v8.0.0...v8.0.1)

The obligatory patch after a major.

#### 🐛 Fixes

-   [#&#8203;4328](https://github.com/mochajs/mocha/issues/4328): Fix `--parallel` when combined with `--watch` ([**@&#8203;boneskull**](https://github.com/boneskull))

### [`v8.0.0`](https://github.com/mochajs/mocha/blob/master/CHANGELOG.md#&#8203;800--2020-06-10)

[Compare Source](https://github.com/mochajs/mocha/compare/v7.2.0...v8.0.0)

In this major release, Mocha adds the ability to _run tests in parallel_. Better late than never! Please note the **breaking changes** detailed below.

Let's welcome [**@&#8203;giltayar**](https://github.com/giltayar) and [**@&#8203;nicojs**](https://github.com/nicojs) to the maintenance team!

#### 💥 Breaking Changes

-   [#&#8203;4164](https://github.com/mochajs/mocha/issues/4164): **Mocha v8.0.0 now requires Node.js v10.0.0 or newer.** Mocha no longer supports the Node.js v8.x line ("Carbon"), which entered End-of-Life at the end of 2019 ([**@&#8203;UlisesGascon**](https://github.com/UlisesGascon))

-   [#&#8203;4175](https://github.com/mochajs/mocha/issues/4175): Having been deprecated with a warning since v7.0.0, **`mocha.opts` is no longer supported** ([**@&#8203;juergba**](https://github.com/juergba))

    ✨ **WORKAROUND:** Replace `mocha.opts` with a [configuration file](https://mochajs.org/#configuring-mocha-nodejs).

-   [#&#8203;4260](https://github.com/mochajs/mocha/issues/4260): Remove `enableTimeout()` (`this.enableTimeout()`) from the context object ([**@&#8203;craigtaub**](https://github.com/craigtaub))

    ✨ **WORKAROUND:** Replace usage of `this.enableTimeout(false)` in your tests with `this.timeout(0)`.

-   [#&#8203;4315](https://github.com/mochajs/mocha/issues/4315): The `spec` option no longer supports a comma-delimited list of files ([**@&#8203;juergba**](https://github.com/juergba))

    ✨ **WORKAROUND**: Use an array instead (e.g., `"spec": "foo.js,bar.js"` becomes `"spec": ["foo.js", "bar.js"]`).

-   [#&#8203;4309](https://github.com/mochajs/mocha/issues/4309): Drop support for Node.js v13.x line, which is now End-of-Life ([**@&#8203;juergba**](https://github.com/juergba))

-   [#&#8203;4282](https://github.com/mochajs/mocha/issues/4282): `--forbid-only` will throw an error even if exclusive tests are avoided via `--grep` or other means ([**@&#8203;arvidOtt**](https://github.com/arvidOtt))

-   [#&#8203;4223](https://github.com/mochajs/mocha/issues/4223): The context object's `skip()` (`this.skip()`) in a "before all" (`before()`) hook will no longer execute subsequent sibling hooks, in addition to hooks in child suites ([**@&#8203;juergba**](https://github.com/juergba))

-   [#&#8203;4178](https://github.com/mochajs/mocha/issues/4178): Remove previously soft-deprecated APIs ([**@&#8203;wnghdcjfe**](https://github.com/wnghdcjfe)):
    -   `Mocha.prototype.ignoreLeaks()`
    -   `Mocha.prototype.useColors()`
    -   `Mocha.prototype.useInlineDiffs()`
    -   `Mocha.prototype.hideDiff()`

#### 🎉 Enhancements

-   [#&#8203;4245](https://github.com/mochajs/mocha/issues/4245): Add ability to run tests in parallel for Node.js (see [docs](https://mochajs.org/#parallel-tests)) ([**@&#8203;boneskull**](https://github.com/boneskull))

    ❗ See also [#&#8203;4244](https://github.com/mochajs/mocha/issues/4244); [Root Hook Plugins (docs)](https://mochajs.org/#root-hook-plugins) -- _root hooks must be defined via Root Hook Plugins to work in parallel mode_

-   [#&#8203;4304](https://github.com/mochajs/mocha/issues/4304): `--require` now works with ES modules ([**@&#8203;JacobLey**](https://github.com/JacobLey))

-   [#&#8203;4299](https://github.com/mochajs/mocha/issues/4299): In some circumstances, Mocha can run ES modules under Node.js v10 -- _use at your own risk!_ ([**@&#8203;giltayar**](https://github.com/giltayar))

#### 📖 Documentation

-   [#&#8203;4246](https://github.com/mochajs/mocha/issues/4246): Add documentation for parallel mode and Root Hook plugins ([**@&#8203;boneskull**](https://github.com/boneskull))

#### 🐛 Fixes

(All bug fixes in Mocha v8.0.0 are also breaking changes, and are listed above)

</details>

---

### Renovate configuration

📅 **Schedule**: "after 9am and before 3pm" (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻️ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-text-to-speech).
sofisl pushed a commit that referenced this issue Nov 10, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [uuid](https://github.com/uuidjs/uuid) | devDependencies | major | [`^7.0.0` -> `^8.0.0`](https://renovatebot.com/diffs/npm/uuid/7.0.3/8.0.0) |

---

### Release Notes

<details>
<summary>uuidjs/uuid</summary>

### [`v8.0.0`](https://github.com/uuidjs/uuid/blob/master/CHANGELOG.md#&#8203;800-httpsgithubcomuuidjsuuidcomparev703v800-2020-04-29)

[Compare Source](https://github.com/uuidjs/uuid/compare/v7.0.3...v8.0.0)

##### ⚠ BREAKING CHANGES

-   For native ECMAScript Module (ESM) usage in Node.js only named exports are exposed, there is no more default export.

    ```diff
    -import uuid from 'uuid';
    -console.log(uuid.v4()); // -> 'cd6c3b08-0adc-4f4b-a6ef-36087a1c9869'
    +import { v4 as uuidv4 } from 'uuid';
    +uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
    ```

-   Deep requiring specific algorithms of this library like `require('uuid/v4')`, which has been deprecated in `uuid@7`, is no longer supported.

    Instead use the named exports that this module exports.

    For ECMAScript Modules (ESM):

    ```diff
    -import uuidv4 from 'uuid/v4';
    +import { v4 as uuidv4 } from 'uuid';
    uuidv4();
    ```

    For CommonJS:

    ```diff
    -const uuidv4 = require('uuid/v4');
    +const { v4: uuidv4 } = require('uuid');
    uuidv4();
    ```

##### Features

-   native Node.js ES Modules (wrapper approach) ([#&#8203;423](https://github.com/uuidjs/uuid/issues/423)) ([2d9f590](https://github.com/uuidjs/uuid/commit/2d9f590ad9701d692625c07ed62f0a0f91227991)), closes [#&#8203;245](https://github.com/uuidjs/uuid/issues/245) [#&#8203;419](https://github.com/uuidjs/uuid/issues/419) [#&#8203;342](https://github.com/uuidjs/uuid/issues/342)
-   remove deep requires ([#&#8203;426](https://github.com/uuidjs/uuid/issues/426)) ([daf72b8](https://github.com/uuidjs/uuid/commit/daf72b84ceb20272a81bb5fbddb05dd95922cbba))

##### Bug Fixes

-   add CommonJS syntax example to README quickstart section ([#&#8203;417](https://github.com/uuidjs/uuid/issues/417)) ([e0ec840](https://github.com/uuidjs/uuid/commit/e0ec8402c7ad44b7ef0453036c612f5db513fda0))

##### [7.0.3](https://github.com/uuidjs/uuid/compare/v7.0.2...v7.0.3) (2020-03-31)

##### Bug Fixes

-   make deep require deprecation warning work in browsers ([#&#8203;409](https://github.com/uuidjs/uuid/issues/409)) ([4b71107](https://github.com/uuidjs/uuid/commit/4b71107d8c0d2ef56861ede6403fc9dc35a1e6bf)), closes [#&#8203;408](https://github.com/uuidjs/uuid/issues/408)

##### [7.0.2](https://github.com/uuidjs/uuid/compare/v7.0.1...v7.0.2) (2020-03-04)

##### Bug Fixes

-   make access to msCrypto consistent ([#&#8203;393](https://github.com/uuidjs/uuid/issues/393)) ([8bf2a20](https://github.com/uuidjs/uuid/commit/8bf2a20f3565df743da7215eebdbada9d2df118c))
-   simplify link in deprecation warning ([#&#8203;391](https://github.com/uuidjs/uuid/issues/391)) ([bb2c8e4](https://github.com/uuidjs/uuid/commit/bb2c8e4e9f4c5f9c1eaaf3ea59710c633cd90cb7))
-   update links to match content in readme ([#&#8203;386](https://github.com/uuidjs/uuid/issues/386)) ([44f2f86](https://github.com/uuidjs/uuid/commit/44f2f86e9d2bbf14ee5f0f00f72a3db1292666d4))

##### [7.0.1](https://github.com/uuidjs/uuid/compare/v7.0.0...v7.0.1) (2020-02-25)

##### Bug Fixes

-   clean up esm builds for node and browser ([#&#8203;383](https://github.com/uuidjs/uuid/issues/383)) ([59e6a49](https://github.com/uuidjs/uuid/commit/59e6a49e7ce7b3e8fb0f3ee52b9daae72af467dc))
-   provide browser versions independent from module system ([#&#8203;380](https://github.com/uuidjs/uuid/issues/380)) ([4344a22](https://github.com/uuidjs/uuid/commit/4344a22e7aed33be8627eeaaf05360f256a21753)), closes [#&#8203;378](https://github.com/uuidjs/uuid/issues/378)

</details>

---

### Renovate configuration

:date: **Schedule**: "after 9am and before 3pm" (UTC).

:vertical_traffic_light: **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

:recycle: **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

:no_bell: **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#googleapis/nodejs-tasks).
sofisl pushed a commit that referenced this issue Nov 11, 2022
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/0e11e365-f1b7-4b92-a9c3-48fa670eb1a0/targets

- [ ] To automatically regenerate this PR, check this box.

Source-Link: googleapis/synthtool@57c23fa
sofisl pushed a commit that referenced this issue Nov 11, 2022
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped) | [`^14.0.0` -> `^16.0.0`](https://renovatebot.com/diffs/npm/@types%2fnode/14.17.32/16.11.6) | [![age](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/compatibility-slim/14.17.32)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@types%2fnode/16.11.6/confidence-slim/14.17.32)](https://docs.renovatebot.com/merge-confidence/) |

---

### Configuration

📅 **Schedule**: "after 9am and before 3pm" (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox.

---

This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-scheduler).
sofisl pushed a commit that referenced this issue Nov 11, 2022
PiperOrigin-RevId: 339708980

Source-Author: Google APIs <noreply@google.com>
Source-Date: Thu Oct 29 11:23:44 2020 -0700
Source-Repo: googleapis/googleapis
Source-Sha: 00bbad4dfd6633cf4b5f9596c1f93b756bb5c776
Source-Link: googleapis/googleapis@00bbad4
sofisl pushed a commit that referenced this issue Jan 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API. 🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants