Add prefixes to results from bucket.getFiles()#342
Conversation
|
Fixed |
regression/storage.js
Outdated
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
@mchmielarski However it goes, could you squash the 'Fix *' commits at some point? |
|
Sorry for my novice question, but could you provide a practical use of prefixes, delimiters, and handling the result returned? |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
|
Re: use case for prefixes is as I understand it a simple filter for files e.g. file search |
|
I'm interested in terms of how one would use this library after merging this PR. I figured instead of guessing by the code, it would be best to let the suggester (PR-sender) help me understand :) |
|
with prefixes and delimiters you can use buckets as tree structure in easy way. I think that comment added to |
|
Would you mind demonstrating with a practical use? |
|
Would be nice with some practical use-cases in the docs. As a normal users I would have no idea what I should be using it for. |
|
Not considering the added complexity of Get folders in bucketfunction getFolders(bucket, callback) {
var query = { delimiter: '/' };
bucket.getFiles(query, function(err, files, nextQuery, prefixes) {
callback(err, prefixes);
});
} |
|
Thank you for that. I know the functionality is in the API, so it makes sense to expose it. But before I can figure out what a good API looks like for it, I need to see how it's meant to be used. Are there other use case anyone can think of? The complexity of prefixes + delimiters still seems quite expensive for such simple results -- assuming the results are "folder names". |
|
I'm only using it with delimiter = function getFoldersInFolder(bucket, folder, callback) {
var query = { delimiter: '/', prefix: folder };
bucket.getFiles(query, function(err, files, nextQuery, folders) {
callback(err, folders);
});
}
getFoldersInFolder(storage.bucket('myBucket'), 'my-photos/', cb); |
|
Using delimiter as something other than As for real-world applications and why-the-heck-would-anyone-do-that-anyway questions, it's beyond me. |
|
As a library that isn't about being a straight API bridge, maybe we can abstract what we're interested in with delimiters and prefixes, and expose them in a more usable way. So far, it sounds like getting files from a specified folder is the benefit. We should be able to make this API work to accomplish that: var query = {
folder: 'images'
};
myBucket.getFiles(query, function (err, files, nextQuery) {
// files = only files in a directory "images"
// delimiter defaults to "/" when `folder` option is given
});And if we think this is important, we can go so far as to create a class for folders: myBucket.getFolders(function(err, folders, nextQuery) {})
myFolder.file("image1.jpg") |
|
Thought experiment: Is it possible to upload a file with a filename that contains the character |
|
I'm confused on this as well, and if I remember correctly, even the Dev Console UI was confused about it. However, as far as I know, |
Not on OS X. Creating a folder named |
|
Check it: https://github.com/evenemento/gcloud-node/tree/v2 |
|
@sindresorhus You're right, you can name the folder with a At least, this is the case that occurs when using the "Upload Folder" feature in the Google Cloud Developer Console. Might not have anything to worry about in this case then. |
|
@ryanseys Yeah, weird, you're right. |
|
I think supporting a Folder object / folder-specific methods is unnecessary. If we can trust |
|
Yes! 100% agree. |
[](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [webpack-cli](https://togithub.com/webpack/webpack-cli) | [`^3.3.10` -> `^4.0.0`](https://renovatebot.com/diffs/npm/webpack-cli/3.3.12/4.2.0) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>webpack/webpack-cli</summary> ### [`v4.2.0`](https://togithub.com/webpack/webpack-cli/releases/webpack-cli@4.2.0) [Compare Source](https://togithub.com/webpack/webpack-cli/compare/webpack-cli@4.1.0...webpack-cli@4.2.0) ##### Bug Fixes - \--config-name behaviour for functional configs ([#​2006](https://togithub.com/webpack/webpack-cli/issues/2006)) ([29ecf8d](https://togithub.com/webpack/webpack-cli/commit/29ecf8dbcd1c5c7d75fc7fb1634107697832d952)) - assign cache value for default configs ([#​2013](https://togithub.com/webpack/webpack-cli/issues/2013)) ([d2e3c74](https://togithub.com/webpack/webpack-cli/commit/d2e3c74d32b0141c694259cf4f31e6c48b0f681d)) - callback deprecation ([#​1977](https://togithub.com/webpack/webpack-cli/issues/1977)) ([2cb0c0e](https://togithub.com/webpack/webpack-cli/commit/2cb0c0e383670949ce31231edbfda514f47c3dfc)) - handle core flags for webpack 4 ([#​2023](https://togithub.com/webpack/webpack-cli/issues/2023)) ([ea66a7e](https://togithub.com/webpack/webpack-cli/commit/ea66a7e3ec6eabcc439b96acb21e2a25be2e35e5)) - help and version functionality ([#​1972](https://togithub.com/webpack/webpack-cli/issues/1972)) ([e8010b3](https://togithub.com/webpack/webpack-cli/commit/e8010b3aac695971e542ad4d3584ce534da39b8f)) ##### Features - export utils from core for other packages ([#​2011](https://togithub.com/webpack/webpack-cli/issues/2011)) ([3004549](https://togithub.com/webpack/webpack-cli/commit/3004549c06b3fe00708d8e1eecf42419e0f72f66)) - progress supports string argument ([#​2000](https://togithub.com/webpack/webpack-cli/issues/2000)) ([f13346e](https://togithub.com/webpack/webpack-cli/commit/f13346e6acb46e982a5d20fa1d2ae56fc52523dc)) - suggest the closest match based on the Levenshtein distance algorithm ([#​2010](https://togithub.com/webpack/webpack-cli/issues/2010)) ([491a582](https://togithub.com/webpack/webpack-cli/commit/491a582620b64ed4acbccd04f687adc28a5e4cff)) ### [`v4.1.0`](https://togithub.com/webpack/webpack-cli/releases/webpack-cli@4.1.0) [Compare Source](https://togithub.com/webpack/webpack-cli/compare/webpack-cli@4.0.0...webpack-cli@4.1.0) ##### Bug Fixes - avoid unnecessary stringify ([#​1920](https://togithub.com/webpack/webpack-cli/issues/1920)) ([5ef1e7b](https://togithub.com/webpack/webpack-cli/commit/5ef1e7b074390406b76cb3e25dd90f045e1bd8a2)) - colored output ([#​1944](https://togithub.com/webpack/webpack-cli/issues/1944)) ([2bbbb14](https://togithub.com/webpack/webpack-cli/commit/2bbbb14ca9a404f2205c0f5a5515e73832ee6173)) - move init command to separate package ([#​1950](https://togithub.com/webpack/webpack-cli/issues/1950)) ([92ad475](https://togithub.com/webpack/webpack-cli/commit/92ad475d4b9606b5db7c31dd3666658301c95597)) - output stacktrace on errors ([#​1949](https://togithub.com/webpack/webpack-cli/issues/1949)) ([9ba9d6f](https://togithub.com/webpack/webpack-cli/commit/9ba9d6f460fb25fb79d52f4360239b8c4b471451)) - run CLI after webpack installation ([#​1951](https://togithub.com/webpack/webpack-cli/issues/1951)) ([564279e](https://togithub.com/webpack/webpack-cli/commit/564279e5b634a399647bcdb21449e5e6a7f0637e)) - support any config name ([#​1926](https://togithub.com/webpack/webpack-cli/issues/1926)) ([6f95b26](https://togithub.com/webpack/webpack-cli/commit/6f95b267bf6a3a3e71360f4de176a4ebbec3afa1)) - support array of functions and promises ([#​1946](https://togithub.com/webpack/webpack-cli/issues/1946)) ([2ace39b](https://togithub.com/webpack/webpack-cli/commit/2ace39b06117f558c0d8528cea9248253cbdf593)) - watch mode and options ([#​1931](https://togithub.com/webpack/webpack-cli/issues/1931)) ([258219a](https://togithub.com/webpack/webpack-cli/commit/258219a3bb606b228636e6373a3d20413c1f660e)) ##### Features - allow passing strings in env flag ([#​1939](https://togithub.com/webpack/webpack-cli/issues/1939)) ([cc081a2](https://togithub.com/webpack/webpack-cli/commit/cc081a256181e34137a89d2e9d37b04280b3f180)) ### [`v4.0.0`](https://togithub.com/webpack/webpack-cli/blob/master/CHANGELOG.md#​400-httpsgithubcomwebpackwebpack-clicomparewebpack-cli400-rc1webpack-cli400-2020-10-10) [Compare Source](https://togithub.com/webpack/webpack-cli/compare/v3.3.12...webpack-cli@4.0.0) ##### Bug Fixes - add compilation lifecycle in watch instance ([#​1903](https://togithub.com/webpack/webpack-cli/issues/1903)) ([02b6d21](https://togithub.com/webpack/webpack-cli/commit/02b6d21eaa20166a7ed37816de716b8fc22b756a)) - cleanup `package-utils` package ([#​1822](https://togithub.com/webpack/webpack-cli/issues/1822)) ([fd5b92b](https://togithub.com/webpack/webpack-cli/commit/fd5b92b3cd40361daec5bf4486e455a41f4c9738)) - cli-executer supplies args further up ([#​1904](https://togithub.com/webpack/webpack-cli/issues/1904)) ([097564a](https://togithub.com/webpack/webpack-cli/commit/097564a851b36b63e0a6bf88144997ef65aa057a)) - exit code for validation errors ([59f6303](https://togithub.com/webpack/webpack-cli/commit/59f63037fcbdbb8934b578b9adf5725bc4ae1235)) - exit process in case of schema errors ([71e89b4](https://togithub.com/webpack/webpack-cli/commit/71e89b4092d953ea587cc4f606451ab78cbcdb93)) ##### Features - assign config paths in build dependencies in cache config ([#​1900](https://togithub.com/webpack/webpack-cli/issues/1900)) ([7e90f11](https://togithub.com/webpack/webpack-cli/commit/7e90f110b119f36ef9def4f66cf4e17ccf1438cd)) </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#github/googleapis/nodejs-security-center).
Update samples to match new Speech API
Update samples to match new Speech API

No description provided.