Method: COS::Bucket#stat
- Defined in:
- lib/cos/bucket.rb
#stat(path = '') ⇒ COSFile|COSDir
Note:
如查询根目录(‘/’, ”)可以获取到bucket信息, 返回COSDir
获取文件或目录信息
321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
# File 'lib/cos/bucket.rb', line 321 def stat(path = '') data = client.api.stat(path, bucket: bucket_name) # 查询'/'获取的是bucket信息, 无name参数, 需要补全 data[:name] = '' if data[:name].nil? if data[:filesize].nil? # 目录 COSDir.new(data.merge({bucket: self, path: path})) else # 文件 COSFile.new(data.merge({bucket: self, path: path})) end end |