Method: COS::API#list
- Defined in:
- lib/cos/api.rb
#list(path, options = {}) ⇒ Object
目录列表/前缀搜索
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/cos/api.rb', line 167 def list(path, = {}) bucket = config.get_bucket([:bucket]) sign = http.signature.multiple(bucket) resource_path = Util.get_resource_path(config.app_id, bucket, path, [:prefix]) pattern = case [:pattern].to_s.to_sym when :dir_only 'eListDirOnly' when :file_only 'eListFileOnly' else 'eListBoth' end query = { op: 'list', num: [:num] || 20, pattern: pattern, order: [:order].to_s.to_sym == :desc ? 1 : 0, context: [:context] } http.get(resource_path, {params: query}, sign) end |