MCPcopy Create free account
hub / github.com/sqlmapproject/sqlmap / save

Method save

thirdparty/bottle/bottle.py:3175–3192  ·  view source on GitHub ↗

Save file to disk or copy its content to an open file(-like) object. If *destination* is a directory, :attr:`filename` is added to the path. Existing files are not overwritten by default (IOError). :param destination: File path, directory or file(-like) object.

(self, destination, overwrite=False, chunk_size=2 ** 16)

Source from the content-addressed store, hash-verified

3173 self.file.seek(offset)
3174
3175 def save(self, destination, overwrite=False, chunk_size=2 ** 16):
3176 """ Save file to disk or copy its content to an open file(-like) object.
3177 If *destination* is a directory, :attr:`filename` is added to the
3178 path. Existing files are not overwritten by default (IOError).
3179
3180 :param destination: File path, directory or file(-like) object.
3181 :param overwrite: If True, replace existing files. (default: False)
3182 :param chunk_size: Bytes to read at a time. (default: 64kb)
3183 """
3184 if isinstance(destination, basestring): # Except file-likes here
3185 if os.path.isdir(destination):
3186 destination = os.path.join(destination, self.filename)
3187 if not overwrite and os.path.exists(destination):
3188 raise IOError('File exists.')
3189 with open(destination, 'wb') as fp:
3190 self._copy_file(fp, chunk_size)
3191 else:
3192 self._copy_file(destination, chunk_size)
3193
3194###############################################################################
3195# Application Helper ###########################################################

Callers

nothing calls this directly

Calls 1

_copy_fileMethod · 0.95

Tested by

no test coverage detected