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

storage: Support for folders #337

Closed
pierre-b opened this issue Dec 22, 2014 · 13 comments
Closed

storage: Support for folders #337

pierre-b opened this issue Dec 22, 2014 · 13 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

@pierre-b
Copy link

Hi,

Is it possible to upload a file into a folder ?

Thanks

@cristiano-belloni
Copy link
Contributor

Hi @pierre-b,
what happens if you do yourBucket.file('myFolderName/myFileName')? It should just work.

@pierre-b
Copy link
Author

Yes @janesconference it works with the createWriteStream function, but not with the bucket.upload one:

bucket.upload(sourcePath, options, function(error, file) {
});

@cristiano-belloni
Copy link
Contributor

Never tried it, so take it with a grain of salt, but you can try:

bucket.upload(encodeURIComponent('myFolderName/myFileName'), options, function(error, file) { });

@pierre-b
Copy link
Author

I think it should be added to the upload() by default, like in S3.

@ryanseys
Copy link
Contributor

I agree. Did you try that and it worked?

@stephenplusplus
Copy link
Contributor

@pierre-b can you paste the code you used to upload the file, as well as what version of gcloud you're using?

@stephenplusplus
Copy link
Contributor

To elaborate more, upload can be called a few different ways, but the most simple is probably:

myBucket.upload("/Users/stephen/Desktop/photo.jpg", function (err, file) {})

In this case, I didn't specify anything about the destination file, only that I want one to be created based on the file at "/Users/stephen/Desktop/photo.jpg". The upload method will detect the file name as being "photo.jpg", and will drop it in your bucket with the same name and the contents at the given file path.

upload doesn't treat your local file system's hierarchy as being identical to your bucket's hierarchy, so it needs to be told explicitly where you wish the file to end up:

myBucket.upload("/Users/stephen/Desktop/photo.jpg", {
  destination: myBucket.file("my-photos/photo.jpg")
}, function (err, file) {})

Now the file should end up inside a directory called "my-photos", named "photo.jpg". If you were using it this way, and it's not working, that's a bug we need to squash.

@stephenplusplus stephenplusplus changed the title Support for folders storage: Support for folders Dec 22, 2014
@ryanseys
Copy link
Contributor

Can confirm that using the destination option and providing a file object like suggested above will correctly upload the file into a folder. @pierre-b Can you confirm this also works for you?

@pierre-b
Copy link
Author

Using v0.11.0 the following doesn't work too, the file is not saved in the folder:

myBucket.upload("/Users/stephen/Desktop/photo.jpg", {
  destination: myBucket.file("my-photos/photo.jpg")
}, function (err, file) {})

@cristiano-belloni
Copy link
Contributor

This is working for me on v0.12.0,

return resourceBucket.upload(
        local,
        {
            destination: remote,
            metadata: { contentType: contentType }
        }, function (err, file) {
            if (cb) {
                cb(err, file);
            }
        });

Where local is my local file name ( ie: '/mylocalpath/myfile' ) and remote is my remote file path ( ie: 'remotepath/myfile' ), both without any encoding.

@stephenplusplus
Copy link
Contributor

Going to close as all signs point to this working. If you still can't get it working, feel free to re-open with more details. If you have ideas for how we can improve the documentation or API to make a better experience for others, those are always welcome as well.

@jgeewax jgeewax added api: storage Issues related to the Cloud Storage API. enhancement labels Feb 2, 2015
@jgeewax jgeewax added this to the Storage Stable milestone Feb 2, 2015
@Marak
Copy link

Marak commented May 8, 2016

There is some issue either here or in github.com/pkgcloud/pkgcloud which is causing encodeURIComponent related issue on downloading files.

Seems that the outgoing URI isn't being encoded automatically?

Don't have much time to dig into it now, but solution was to use encodeURIComponent on outgoing path for downloading file inside folder. Uploading seemed to have encoding / decoding working correctly.

Will update if I ever get more information. Patch is holding here.

@stephenplusplus
Copy link
Contributor

stephenplusplus commented May 9, 2016

If the request is going through pkgcloud, that means it's using gcloud­@0.10. We're currently on 0.32. Here's the issue which asks for gcloud to be updated: pkgcloud/pkgcloud#452, but the maintainers have some issues with doing it.

In the past, we have missed a few encodeURIComponents, and it's possible 0.10 was before we caught them.

@yoshi-automation yoshi-automation added 🚨 This issue needs some love. triage me I really want to be triaged. labels Apr 6, 2020
chingor13 pushed a commit that referenced this issue Aug 22, 2022
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/9b55eba7-85ee-48d5-a737-8b677439db4d/targets

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

Source-Link: googleapis/synthtool@1c92077
sofisl pushed a commit that referenced this issue Sep 16, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [null-loader](https://togithub.com/webpack-contrib/null-loader) | devDependencies | major | [`^3.0.0` -> `^4.0.0`](https://renovatebot.com/diffs/npm/null-loader/3.0.0/4.0.0) |

---

### Release Notes

<details>
<summary>webpack-contrib/null-loader</summary>

### [`v4.0.0`](https://togithub.com/webpack-contrib/null-loader/blob/master/CHANGELOG.md#&#8203;400-httpsgithubcomwebpack-contribnull-loadercomparev300v400-2020-04-15)

[Compare Source](https://togithub.com/webpack-contrib/null-loader/compare/v3.0.0...v4.0.0)

##### Bug Fixes

-   support `webpack@5`

##### ⚠ BREAKING CHANGES

-   minimum required Nodejs version is `10.13`

</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-os-login).
sofisl pushed a commit that referenced this issue Oct 5, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [null-loader](https://togithub.com/webpack-contrib/null-loader) | devDependencies | major | [`^3.0.0` -> `^4.0.0`](https://renovatebot.com/diffs/npm/null-loader/3.0.0/4.0.0) |

---

### Release Notes

<details>
<summary>webpack-contrib/null-loader</summary>

### [`v4.0.0`](https://togithub.com/webpack-contrib/null-loader/blob/master/CHANGELOG.md#&#8203;400-httpsgithubcomwebpack-contribnull-loadercomparev300v400-2020-04-15)

[Compare Source](https://togithub.com/webpack-contrib/null-loader/compare/v3.0.0...v4.0.0)

##### Bug Fixes

-   support `webpack@5`

##### ⚠ BREAKING CHANGES

-   minimum required Nodejs version is `10.13`

</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-os-login).
sofisl pushed a commit that referenced this issue Oct 5, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [null-loader](https://togithub.com/webpack-contrib/null-loader) | devDependencies | major | [`^3.0.0` -> `^4.0.0`](https://renovatebot.com/diffs/npm/null-loader/3.0.0/4.0.0) |

---

### Release Notes

<details>
<summary>webpack-contrib/null-loader</summary>

### [`v4.0.0`](https://togithub.com/webpack-contrib/null-loader/blob/master/CHANGELOG.md#&#8203;400-httpsgithubcomwebpack-contribnull-loadercomparev300v400-2020-04-15)

[Compare Source](https://togithub.com/webpack-contrib/null-loader/compare/v3.0.0...v4.0.0)

##### Bug Fixes

-   support `webpack@5`

##### ⚠ BREAKING CHANGES

-   minimum required Nodejs version is `10.13`

</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-os-login).
sofisl pushed a commit that referenced this issue Oct 8, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [null-loader](https://togithub.com/webpack-contrib/null-loader) | devDependencies | major | [`^3.0.0` -> `^4.0.0`](https://renovatebot.com/diffs/npm/null-loader/3.0.0/4.0.0) |

---

### Release Notes

<details>
<summary>webpack-contrib/null-loader</summary>

### [`v4.0.0`](https://togithub.com/webpack-contrib/null-loader/blob/master/CHANGELOG.md#&#8203;400-httpsgithubcomwebpack-contribnull-loadercomparev300v400-2020-04-15)

[Compare Source](https://togithub.com/webpack-contrib/null-loader/compare/v3.0.0...v4.0.0)

##### Bug Fixes

-   support `webpack@5`

##### ⚠ BREAKING CHANGES

-   minimum required Nodejs version is `10.13`

</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-os-login).
sofisl pushed a commit that referenced this issue Oct 13, 2022
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [@types/sinon](https://togithub.com/DefinitelyTyped/DefinitelyTyped) | devDependencies | major | [`^7.5.2` -> `^9.0.0`](https://renovatebot.com/diffs/npm/@types%2fsinon/7.5.2/9.0.0) |

---

### 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-bigquery-data-transfer).
sofisl pushed a commit that referenced this issue Nov 11, 2022
* updated CHANGELOG.md

* updated package.json

* updated samples/package.json

* make a note about dropping support
sofisl pushed a commit that referenced this issue Nov 11, 2022
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 468790263

Source-Link: googleapis/googleapis@873ab45

Source-Link: googleapis/googleapis-gen@cb6f37a
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2I2ZjM3YWVmZjJhMzQ3MmU0MGE3YmJhY2U4YzY3ZDc1ZTI0YmVlNSJ9
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 |
|---|---|---|---|---|---|
| [sinon](https://sinonjs.org/) ([source](https://togithub.com/sinonjs/sinon)) | [`^12.0.0` -> `^13.0.0`](https://renovatebot.com/diffs/npm/sinon/12.0.1/13.0.0) | [![age](https://badges.renovateapi.com/packages/npm/sinon/13.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/sinon/13.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/sinon/13.0.0/compatibility-slim/12.0.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/sinon/13.0.0/confidence-slim/12.0.1)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>sinonjs/sinon</summary>

### [`v13.0.0`](https://togithub.com/sinonjs/sinon/blob/HEAD/CHANGES.md#&#8203;1300)

[Compare Source](https://togithub.com/sinonjs/sinon/compare/v12.0.1...v13.0.0)

-   [`cf3d6c0c`](https://togithub.com/sinonjs/sinon/commit/cf3d6c0cd9689c0ee673b3daa8bf9abd70304392)
    Upgrade packages ([#&#8203;2431](https://togithub.com/sinonjs/sinon/issues/2431)) (Carl-Erik Kopseng)
    > -   Update all @&#8203;sinonjs/ packages
    >
    > -   Upgrade to fake-timers 9
    >
    > -   chore: ensure always using latest LTS release
-   [`41710467`](https://togithub.com/sinonjs/sinon/commit/417104670d575e96a1b645ea40ce763afa76fb1b)
    Adjust deploy scripts to archive old releases in a separate branch, move existing releases out of master ([#&#8203;2426](https://togithub.com/sinonjs/sinon/issues/2426)) (Joel Bradshaw)
    > Co-authored-by: Carl-Erik Kopseng <[email protected]>
-   [`c80a7266`](https://togithub.com/sinonjs/sinon/commit/c80a72660e89d88b08275eff1028ecb9e26fd8e9)
    Bump node-fetch from 2.6.1 to 2.6.7 ([#&#8203;2430](https://togithub.com/sinonjs/sinon/issues/2430)) (dependabot\[bot])
    > Co-authored-by: dependabot\[bot] <49699333+dependabot\[bot][@&#8203;users](https://togithub.com/users).noreply.github.com>
-   [`a00f14a9`](https://togithub.com/sinonjs/sinon/commit/a00f14a97dbe8c65afa89674e16ad73fc7d2fdc0)
    Add explicit export for `./*` ([#&#8203;2413](https://togithub.com/sinonjs/sinon/issues/2413)) (なつき)
-   [`b82ca7ad`](https://togithub.com/sinonjs/sinon/commit/b82ca7ad9b1add59007771f65a18ee34415de8ca)
    Bump cached-path-relative from 1.0.2 to 1.1.0 ([#&#8203;2428](https://togithub.com/sinonjs/sinon/issues/2428)) (dependabot\[bot])
-   [`a9ea1427`](https://togithub.com/sinonjs/sinon/commit/a9ea142716c094ef3c432ecc4089f8207b8dd8b6)
    Add documentation for assert.calledOnceWithMatch ([#&#8203;2424](https://togithub.com/sinonjs/sinon/issues/2424)) (Mathias Schreck)
-   [`1d5ab86b`](https://togithub.com/sinonjs/sinon/commit/1d5ab86ba60e50dd69593ffed2bffd4b8faa0d38)
    Be more general in stripping off stack frames to fix Firefox tests ([#&#8203;2425](https://togithub.com/sinonjs/sinon/issues/2425)) (Joel Bradshaw)
-   [`56b06129`](https://togithub.com/sinonjs/sinon/commit/56b06129e223eae690265c37b1113067e2b31bdc)
    Check call count type ([#&#8203;2410](https://togithub.com/sinonjs/sinon/issues/2410)) (Joel Bradshaw)
-   [`7863e2df`](https://togithub.com/sinonjs/sinon/commit/7863e2dfdbda79e0a32e42af09e6539fc2f2b80f)
    Fix [#&#8203;2414](https://togithub.com/sinonjs/sinon/issues/2414): make Sinon available on homepage (Carl-Erik Kopseng)
-   [`fabaabdd`](https://togithub.com/sinonjs/sinon/commit/fabaabdda82f39a7f5b75b55bd56cf77b1cd4a8f)
    Bump nokogiri from 1.11.4 to 1.13.1 ([#&#8203;2423](https://togithub.com/sinonjs/sinon/issues/2423)) (dependabot\[bot])
-   [`dbc0fbd2`](https://togithub.com/sinonjs/sinon/commit/dbc0fbd263c8419fa47f9c3b20cf47890a242d21)
    Bump shelljs from 0.8.4 to 0.8.5 ([#&#8203;2422](https://togithub.com/sinonjs/sinon/issues/2422)) (dependabot\[bot])
-   [`fb8b3d72`](https://togithub.com/sinonjs/sinon/commit/fb8b3d72a85dc8fb0547f859baf3f03a22a039f7)
    Run Prettier (Carl-Erik Kopseng)
-   [`12a45939`](https://togithub.com/sinonjs/sinon/commit/12a45939e9b047b6d3663fe55f2eb383ec63c4e1)
    Fix 2377: Throw error when trying to stub non-configurable or non-writable properties ([#&#8203;2417](https://togithub.com/sinonjs/sinon/issues/2417)) (Stuart Dotson)
    > Fixes issue [#&#8203;2377](https://togithub.com/sinonjs/sinon/issues/2377) by throwing an error when trying to stub non-configurable or non-writable properties

*Released by [Carl-Erik Kopseng](https://togithub.com/fatso83) on 2022-01-28.*

</details>

---

### 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-datalabeling).
sofisl pushed a commit that referenced this issue Nov 11, 2022
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [jsdoc-fresh](https://togithub.com/googleapis/jsdoc-fresh) | [`^1.0.2` -> `^2.0.0`](https://renovatebot.com/diffs/npm/jsdoc-fresh/1.1.1/2.0.0) | [![age](https://badges.renovateapi.com/packages/npm/jsdoc-fresh/2.0.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/jsdoc-fresh/2.0.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/jsdoc-fresh/2.0.0/compatibility-slim/1.1.1)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/jsdoc-fresh/2.0.0/confidence-slim/1.1.1)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>googleapis/jsdoc-fresh</summary>

### [`v2.0.0`](https://togithub.com/googleapis/jsdoc-fresh/blob/HEAD/CHANGELOG.md#&#8203;200-httpsgithubcomgoogleapisjsdoc-freshcomparev111v200-2022-05-18)

[Compare Source](https://togithub.com/googleapis/jsdoc-fresh/compare/v1.1.1...v2.0.0)

##### ⚠ BREAKING CHANGES

-   update library to use Node 12 ([#&#8203;108](https://togithub.com/googleapis/jsdoc-fresh/issues/108))

##### Build System

-   update library to use Node 12 ([#&#8203;108](https://togithub.com/googleapis/jsdoc-fresh/issues/108)) ([e61c223](https://togithub.com/googleapis/jsdoc-fresh/commit/e61c2238db8900e339e5fe7fb8aea09642290182))

##### [1.1.1](https://www.github.com/googleapis/jsdoc-fresh/compare/v1.1.0...v1.1.1) (2021-08-11)

##### Bug Fixes

-   **build:** migrate to using main branch ([#&#8203;83](https://www.togithub.com/googleapis/jsdoc-fresh/issues/83)) ([9474adb](https://www.github.com/googleapis/jsdoc-fresh/commit/9474adbf0d559d319ff207397ba2be6b557999ac))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 9am and before 3pm" (UTC), Automerge - At any time (no schedule defined).

🚦 **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 [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/googleapis/nodejs-document-ai).
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/9b55eba7-85ee-48d5-a737-8b677439db4d/targets

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

Source-Link: googleapis/synthtool@1c92077
sofisl pushed a commit that referenced this issue Nov 11, 2022
- [ ] Regenerate this pull request now.

PiperOrigin-RevId: 468790263

Source-Link: googleapis/googleapis@873ab45

Source-Link: googleapis/googleapis-gen@cb6f37a
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2I2ZjM3YWVmZjJhMzQ3MmU0MGE3YmJhY2U4YzY3ZDc1ZTI0YmVlNSJ9
sofisl pushed a commit that referenced this issue Nov 17, 2022
sofisl pushed a commit that referenced this issue Nov 18, 2022
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

No branches or pull requests

7 participants