public void 特定のバケットにオブジェクトをダウンロードする()
        {
            var assembly = Assembly.GetExecutingAssembly();
            GetObjectRequest getObjectRequest = new GetObjectRequest
            {
                NamespaceName = NameSpaceName,
                BucketName    = "bigfile_bucket",
                ObjectName    = "test.csv.gz"
            };

            ObjectStorageClient.DownloadObject(getObjectRequest, @"C:\test.csv.gz");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Copies from ObjectStorage to the local file system.
        /// If the file already exists on the local file system and overwrite is set to false than an ArgumentException is thrown.
        /// </summary>
        /// <param name="destFileName">The path where to copy the file to.</param>
        /// <param name="overwrite">Determines whether the file can be overwritten.</param>
        /// <exception cref="T:System.IO.IOException">If the file already exists locally and overwrite is set to false.</exception>
        /// <exception cref="T:System.Net.WebException"></exception>
        /// <returns>FileInfo for the local file where file is copied to.</returns>
        public FileInfo CopyToLocal(string destFileName, bool overwrite)
        {
            if (!overwrite)
            {
                if (new FileInfo(destFileName).Exists)
                {
                    throw new IOException("File already exists");
                }
            }

            var getObjectRequest = new GetObjectRequest
            {
                NamespaceName = namespaceName,
                BucketName    = bucket,
                ObjectName    = ObjectStorageHelper.EncodeKey(key)
            };

            client.DownloadObject(getObjectRequest, destFileName);

            return(new FileInfo(destFileName));
        }