GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Specify folder parameter for folder-based filter by ryanseys · Pull Request #361 · googleapis/google-cloud-node

Conversation

@ryanseys

@ryanseys ryanseys commented Jan 23, 2015

Copy link
Copy Markdown
Contributor

Add folder-based filtering to Bucket#getFiles with a folder query parameter.

Also implemented weird idea for returning prefixes for #342. I'm not sure how bad an idea it is, but basically return the prefixes as a property of the files Array. Yes, a property on an Array... How bad of an idea is that? 👶

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Jan 23, 2015
@ryanseys
storage: specify folder parameter for folder-based filter
922071c
@ryanseys ryanseys added enhancement api: storage Issues related to the Cloud Storage API. labels Jan 23, 2015
@ryanseys

ryanseys commented Jan 23, 2015

Copy link
Copy Markdown
Contributor Author

Agh, tags. What ones do I use?? I just added a boat-load of them.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

parkr
parkr reviewed Jan 23, 2015
View reviewed changes
Comment thread lib/storage/bucket.js

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stephenplusplus

stephenplusplus commented Jan 23, 2015

Copy link
Copy Markdown
Contributor

Agh, tags. What ones do I use?? I just added a boat-load of them.

Lol

What does the API response (resp.prefixes) look like? I don't feel like giving the dev a prefixes property on the files array is too important or useful. If they're using the folder property on a query passed to getFiles, they may not even realize we're using "prefixes" and "delimiters" under the hood, and wouldn't know what to do with that.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stephenplusplus stephenplusplus removed in progress labels Jan 23, 2015
@stephenplusplus

stephenplusplus commented Jan 23, 2015

Copy link
Copy Markdown
Contributor

in progress and ready for review are relics from the days of waffle.io. opinions wanted and enhancement (and really, anything except for the service a PR is affecting) make more sense to me to be used on issues. But, I won't remove them again if you would like them back :)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ryanseys

ryanseys commented Jan 23, 2015

Copy link
Copy Markdown
Contributor Author

What does the API response (resp.prefixes) look like?

Looks something like [ 'test/goodbye/', 'test/hello/' ] when folder is set to test so basically, it's the folders in a given folder. What if we used a new query flag that the developer can specify and then we will return them in the prefixes property. Like includePrefixes: true or something?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stephenplusplus

stephenplusplus commented Jan 23, 2015

Copy link
Copy Markdown
Contributor

What if on the File object itself, it had a "folder" property that was it's prefix? I don't think an array of prefixes is too useful.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ryanseys

ryanseys commented Jan 23, 2015

Copy link
Copy Markdown
Contributor Author

Yeah, thought of that too! A complaint I have with that with doing that is that suddenly everyone's code will need to handle the case where the file isn't actually a file and has no metadata or id or anything, and just contains a folder property instead.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stephenplusplus

stephenplusplus commented Jan 23, 2015

Copy link
Copy Markdown
Contributor

How would that happen? I'm envisioning:

bucket.getFiles(function(err, files) {
  files[0].name = 'iamin/a/folder.jpg'
  files[0].folder = 'iamin/a'

  files[1].name = 'iamnotinafolder.jpg'
  files[0].folder = undefined
});

Though, chasing this thought down, I'm still not sure that's a helpful bit of knowledge to have. If I really wanted to, I could use the native path module to parse out the folder/extension from a file path. The most important thing should be bucket.getFiles({ folder: 'a/folder' }) to get only the files from a folder, and bucket.getFolders() (which I don't think we know how to do yet / haven't implemented).

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ryanseys

ryanseys commented Jan 23, 2015

Copy link
Copy Markdown
Contributor Author

The problem with your example is that the files might not exist but the folders would. Also, bucket.getFiles({ folder: 'test' }) returns the files in the test folder (and the folder itself), and prefixes returns the folders in that folder.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ryanseys

ryanseys commented Jan 23, 2015

Copy link
Copy Markdown
Contributor Author

Because, the test folder is returned the results, we could add the prefixes as a subfolders property on that object in the files list? This won't work for the root folder (/) because it's not a folder, it's just the root. In that case, getting the subfolders in the root would be impossible which isn't ideal.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stephenplusplus

stephenplusplus commented Jan 23, 2015

Copy link
Copy Markdown
Contributor

My head is spinning a bit, because I still don't see the value to a user. There's clear value to bucket.getFiles({ folder: 'a/folder' }), and bucket.getFolders() would be nice as well, though not as vital. Even for a power-user, getting a File object that retains knowledge of the folder it's in or sub-folder, or prefix, etc, isn't something I can see being useful. And if I'm wrong and the user does need that information, they can solve the problem simply by putting files that were retrieved from a folder into a data structure that's labeled as such:

var folders = { dir1: [], dir2: [] };

Object.keys(folders).forEach(function(folder) {
  bucket.getFiles({ folder: folder }, function (err, files) {
    folders[folder] = files;
  });
});

Hope I'm not overlooking something obvious. As is evident from my history on this project, it sometimes just takes a while for me to understand the Google APIs :)

// also, would it be useful / possible to accept getFiles({ folders: ['folder1', 'folder2'] })?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ryanseys

ryanseys commented Jan 23, 2015

Copy link
Copy Markdown
Contributor Author

Yeah my head is spinning too. In this case I think it's best if we just find the simplest way to return the parameter rather than potentially messing up some folder-related methods that we don't fully understand.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ryanseys

ryanseys commented Jan 27, 2015

Copy link
Copy Markdown
Contributor Author

Ok, no folder value, how about just returning prefixes so that this value can be used to allow developers to create their own similar functionality if required (e.g. like in #342)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@stephenplusplus

stephenplusplus commented Jan 27, 2015

Copy link
Copy Markdown
Contributor

I'll let you make the call on this.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ryanseys

ryanseys commented Jan 27, 2015

Copy link
Copy Markdown
Contributor Author

Yeah, I've decided this idea sucks. Will reconsider #342 or something similar.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ryanseys ryanseys closed this Jan 27, 2015
@ryanseys
ryanseys deleted the storage-folders branch January 27, 2015 16:14
@GautamSharda GautamSharda mentioned this pull request Feb 5, 2026
migrate code from googleapis/nodejs-error-reporting #7169
Closed
4 tasks
@sofisl sofisl added the library: cloud-profiler Issues transferred from another repository label Feb 7, 2026
sofisl pushed a commit that referenced this pull request Feb 17, 2026
@stephenplusplus
build: fix system tests (#361)
c5f13d5
Fixes #357
@sofisl sofisl mentioned this pull request Feb 17, 2026
migrate code from googleapis/nodejs-datastore #7263
Merged
4 tasks
GautamSharda pushed a commit that referenced this pull request Feb 23, 2026
@JustinBeckwith
refactor: remove request and ineffective tests (#361)
4138d98
@GautamSharda GautamSharda mentioned this pull request Feb 23, 2026
migrate code from googleapis/nodejs-error-reporting #7294
Closed
sofisl pushed a commit that referenced this pull request Feb 25, 2026
@fhinkel @JustinBeckwith
fix: make dependency on request explicit (#361)
c3fd483
Somehow we got away without including request as dependency. Making
that implicit so we don't run into problems when pubsub updates.

 npm ls request
@google-cloud/[email protected] /Users/franzih/code/gcp/nodejs-storage
├─┬ @google-cloud/[email protected]
│ ├─┬ @google-cloud/[email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]  deduped
│ │ ├── [email protected]  deduped
│ │ └─┬ [email protected]
│ │   └── [email protected]  deduped
│ └─┬ [email protected]
│   └── [email protected]  deduped
├─┬ [email protected]
│ └── [email protected]
└─┬ [email protected]
  └── [email protected]  deduped
GautamSharda pushed a commit that referenced this pull request Feb 25, 2026
@renovate-bot
chore(deps): update dependency @google-cloud/bigquery to v7 (#361)
159907c
@GautamSharda GautamSharda mentioned this pull request Feb 25, 2026
migrate code from googleapis/nodejs-bigquery-storage #7306
Closed
4 tasks
GautamSharda pushed a commit that referenced this pull request Feb 26, 2026
@JustinBeckwith
refactor: remove request and ineffective tests (#361)
078f154
@GautamSharda GautamSharda mentioned this pull request Feb 26, 2026
migrate code from googleapis/nodejs-error-reporting #7308
Merged
4 tasks
sofisl pushed a commit that referenced this pull request Feb 26, 2026
@stephenplusplus @JustinBeckwith
fix: Only run mutations inside of a transaction. (#361)
9924b47
@GautamSharda GautamSharda mentioned this pull request Mar 5, 2026
migrate code from googleapis/nodejs-bigquery-storage #7496
Merged
4 tasks
sofisl pushed a commit that referenced this pull request Mar 5, 2026
@fhinkel
chore(nodejs): update client ref docs link in metadata (#361)
7d77844
@codyoss codyoss mentioned this pull request Mar 9, 2026
migrate code from googleapis/nodejs-paginator #7536
Closed
codyoss pushed a commit that referenced this pull request Mar 9, 2026
@alvarowolfx
fix: should pass extra callback arguments back to consumer (#361)
20fef27
codyoss pushed a commit that referenced this pull request Mar 11, 2026
@alvarowolfx @codyoss
fix: should pass extra callback arguments back to consumer (#361)
b91c936
@codyoss codyoss mentioned this pull request Mar 11, 2026
migrate code from googleapis/nodejs-paginator #7590
Merged
GautamSharda pushed a commit that referenced this pull request Mar 11, 2026
@vijay-qlogic @JustinBeckwith
refactor(ts): added ts style fix for src/topic.ts (#361)
f9da786
This was referenced Mar 11, 2026
migrate code from googleapis/nodejs-pubsub #7592
Merged
migrate code from googleapis/nodejs-promisify #7595
Closed
GautamSharda pushed a commit that referenced this pull request Mar 12, 2026
@release-please
chore(main): release 4.1.0 (#361)
f649b8e
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
@GautamSharda GautamSharda mentioned this pull request Mar 12, 2026
migrate code from googleapis/nodejs-promisify #7596
Merged
4 tasks
GautamSharda pushed a commit that referenced this pull request Mar 12, 2026
@release-please
chore(main): release 4.1.0 (#361)
0c11dd3
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
thiyaguk09 pushed a commit to thiyaguk09/google-cloud-node-fork that referenced this pull request Mar 18, 2026
@fhinkel @JustinBeckwith
fix: make dependency on request explicit (googleapis#361)
7d71920
Somehow we got away without including request as dependency. Making
that implicit so we don't run into problems when pubsub updates.

 npm ls request
@google-cloud/[email protected] /Users/franzih/code/gcp/nodejs-storage
├─┬ @google-cloud/[email protected]
│ ├─┬ @google-cloud/[email protected]
│ │ ├─┬ [email protected]
│ │ │ └── [email protected]  deduped
│ │ ├── [email protected]  deduped
│ │ └─┬ [email protected]
│ │   └── [email protected]  deduped
│ └─┬ [email protected]
│   └── [email protected]  deduped
├─┬ [email protected]
│ └── [email protected]
└─┬ [email protected]
  └── [email protected]  deduped
GautamSharda pushed a commit that referenced this pull request Mar 23, 2026
@jkwlui @JustinBeckwith
chore: use latest npm on Windows (#361)
f55ed95
@GautamSharda GautamSharda mentioned this pull request Mar 23, 2026
migrate code from googleapis/nodejs-bigtable #7852
Merged
4 tasks
GautamSharda pushed a commit that referenced this pull request Mar 25, 2026
@jkwlui @GautamSharda
chore: use latest npm on Windows (#361)
52ba862
shivanee-p pushed a commit that referenced this pull request Mar 27, 2026
@jkwlui @shivanee-p
chore: use latest npm on Windows (#361)
4347da3
thiyaguk09 pushed a commit to thiyaguk09/google-cloud-node-fork that referenced this pull request May 5, 2026
@jkwlui @thiyaguk09
chore: use latest npm on Windows (googleapis#361)
b3abfde
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

api: storage Issues related to the Cloud Storage API. cla: yes This human has signed the Contributor License Agreement. library: cloud-profiler Issues transferred from another repository

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@ryanseys @stephenplusplus @parkr @googlebot @sofisl
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.