'How to download the file from google cloud storage bucket sub directory
I have GCS bucket //mycloudstorage and this bucket contains multiple subdirectories like below //mycloudstorage/Emails/2021/01/banner.html.
here I want download the file banner.html from the subdirectory.
I have tried below code but its giving me error file not found IO Exception
static void Main(string[] args)
{
var fileDownloadPath = Path.Combine(@"D:\banner.html");
Environment.SetEnvironmentVariable("GOOGLE_APPLICATION_CREDENTIALS", @"D:\GCPAccess\service_account_key.json");
var storage = StorageClient.Create();
var outputFile = File.OpenWrite(fileDownloadPath);
storage.DownloadObject("mycloudstorage", @"Emails/2021/01/banner.html", outputFile);
}
Can this is been possible using c#??
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
