-
Notifications
You must be signed in to change notification settings - Fork 605
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
Hide extraneous GCN plumbing from returned objects #2217
Comments
There is a lot of stuff on the object-- some is plumbing that enables our API to function. The only thing that's really meant for the user is the In the context of bucket.getFiles(function(err, files) {
if (!err) {
var fileMetadataObjects = files.map(function(file) {
return file.metadata
})
fs.writeFileSync("files.json", JSON.stringify(fileMetadataObjects))
} else {
console.error(err)
}
}) And of course, if you just want the name, you can use |
Just to address the 271,000 lines of JSON, though, I'm not particularly thrilled about that. From a quick test, the output of one file for me was about 1,200 lines. I'll re-open so we can define those huge objects as non-enumerable, so they're hidden from the output. |
Ok so do I understand correctly that only the metadata is actually downloaded from the server? |
Yes, everything else is state and internal data. |
Cool, then it was just me panicking :) |
This issue was moved to googleapis/nodejs-storage#19 |
This would be a change in |
This issue was moved to googleapis/nodejs-common#13. |
Fetching a list of files from my bucket produces 271K of JSON output from the server. And I just have 4 files in the bucket.
The data includes things like the complete description of the bucket itself (per every file) or the description of the googlecloud storage library (authors, dependencies, etc). Some of this is probably not loaded from the server but is added by the node api library. Even if that doesn't lead to network traffic it's still unnecessary and inconvenient when I try to find the relevant data. The screenshot below show the data structure with most elements collapsed. None of those elements are relevant for listing files in the bucket. I only want to see the data that is printed by
gsutil
when doingls
.https://www.dropbox.com/s/4dgpu7jh8z6lb9h/Screen%20Shot%202017-04-13%20at%2013.29.58.png?dl=0
I might be missing some option or parameter that would limit the output from getFiles.
Environment details
Steps to reproduce
The text was updated successfully, but these errors were encountered: