Method: QcloudCos::ConvenientApi#exists?
- Defined in:
- lib/qcloud_cos/convenient_api.rb
permalink #exists?(path = '/', options = {}) ⇒ Boolean Also known as: exist?
判断文件或者文件夹是否存在
73 74 75 76 77 78 79 |
# File 'lib/qcloud_cos/convenient_api.rb', line 73 def exists?(path = '/', = {}) return true if path == '/' || path.to_s.empty? result = stat(path, ) result.key?('data') && result['data'].key?('name') rescue false end |