Method: Aspose::Cloud::AsposeStorage::Folder#file_exists

Defined in:
lib/Storage/folder.rb

#file_exists(filename, storage_type = 'Aspose', storage_name = '') ⇒ Object

Check if a file exists on the storage

@param string filename Name of the file.


48
49
50
51
52
53
54
55
56
57
58
# File 'lib/Storage/folder.rb', line 48

def file_exists(filename, storage_type = 'Aspose', storage_name = '')
    raise('Filename cannot be empty') if filename.empty?

    str_uri = @str_uri_exist + filename
    str_uri = Aspose::Cloud::Common::Utils.append_storage(str_uri,'',storage_name,storage_type)

    signed_str_uri = Aspose::Cloud::Common::Utils.sign(str_uri)

    response_stream = RestClient.get(signed_str_uri, {:accept => 'application/json'})
    JSON.parse(response_stream)['FileExist']['IsExist']
end