GeezerVison is showing github.com — List Bucket and List File · Issue #478 · googleapis/google-cloud-node
List Bucket and List File #478Labels 🚨This issue needs some love.api: storageIssues related to the Cloud Storage API.triage meI really want to be triaged. DescriptionHi all,
sorry but There isn't documentation about that.
is possible to have a bucket list and file list?
thanks Activityizzusan83 commented on Apr 3, 2015 ok i find the metod for to have bucket list and file list:
// list all BUCKET
storage.getBuckets(function(err, buckets, nextQuery) {
for(var i = 0; i<buckets.length; i++ ){
// The `metadata` property is populated for you with the metadata at the
// time of fetching.
console.log(buckets[i].metadata.id);
}
});
// list all file
bucket.getFiles(function(err, files, nextQuery) {
// The `metadata` property is populated for you with the metadata at the
// time of fetching.
for(var i = 0; i<files.length; i++ ){
// The `metadata` property is populated for you with the metadata at the
// time of fetching.
console.log(files[i].metadata.name);
}
// However, in cases where you are concerned the metadata could have
// changed, use the `getMetadata` method.
//files[0].getMetadata(function(err, metadata) {});
});
but now i have another question...
is possible to create a folder in the bucket?
thanks a lot leibale commented on Apr 4, 2015 if you create file in path doesn't exist google will create the folders for you stephenplusplus commented on Apr 6, 2015 As far as I know, that's the only way to create a folder outside of the Developer's Console UI. I think the solution of uploading a file and having a folder created in the process is fine, but feel free to correct me if you have a use case where that's not fine. izzusan83 commented on Apr 13, 2015 yes, is true...
function(err,httpResponse,body){
var responseJson = JSON.parse(body);
if(responseJson.success){
callToFunctionInModule("Start Upload in GoogleStorage", cb);
var image = bucket.file('ddsImage.dds');
fs.createReadStream(__dirname + '../../temp/ddsConversion/' + folderName + '/ddsImage.dds')
.pipe(image.createWriteStream())
.on('error', function(err) {
console.log(err);
})
.on('complete', function() {
}
console.log('The file upload is complete.');
});
}
});
The folder temp doesn't exist. The first time google create the folder id doesn't exist.
but if i need to remove the folder? I sow the method for remove file and buket but not for remove a folder,
Thanks a lot
MetadataMetadata🚨This issue needs some love.api: storageIssues related to the Cloud Storage API.triage meI really want to be triaged. DevelopmentNo branches or pull requestsIssue actions
|