Skip to main content

Folder

class: edge.api.Folder

Represents a folder in the Edge file system.

Methods

Reference

list()

List all file and folder names in this folder.

Returns:

     list(tr)

         List of File and Folder names.

Raises:

NotFound

list_files()

List all file names in this folder.

Returns:

     list(str)

         List of file names.

Raises:

NotFound

list_folders()

List all folder names in this folder.

Returns:

     list(str)

         List of folder names.

Raises:

NotFound

open()

Open an existing file or folder.

Parameters:

  • name (str) — The name of the file or folder to open. May be a delimited series of folder names like "/this/folder/file" and we will walk all folders and open the final one.
  • open_with (str) — Optional; name of an opener to use to open the object. Examples are "pandas" or "imageio", or "file" to get a file-like object giving access to the raw bytes. If not specified, an opener will be automatically picked for you.

Returns:

object, File, or Folder

Raises:

  • NotFound
  • ValueError

download()

Download to a local file.

Currently, only files are supported.

Parameters:

  • name (str) — Path/name of the remote object
  • localpath (str, optional) — Download to this path locally. Defaults to the same basename in the current working directory.

upload()

Upload a file to a folder.

Parameters:

  • destination (str) — The path/name of the file upload destination.
  • fp (file-like) — An object having callable read() returning bytes object.
  • overwrite (bool) — If true, any existing file will be overwritten

Raises:

NotFound

make_folder()

Make a new folder.

Parameters:

  • name (str) — The name of the folder to create under this folder. May be a delimited series of folder names like "/this/folder/path" and we will ensure all folders in that series are created.

Returns:

Folder

move()

Move a file or folder.

Parameters:

  • source (str) — The file or folder in this folder to move, or path to source
  • destination (str) — The path to the file to move to.

rename()

Rename a file or folder.

Parameters:

  • source (str) — The file or folder in this folder to rename.
  • name (str) — The new name for the source object

delete()

Delete a file or folder.

Parameters:

  • object (str) -- The file or folder to delete, or path to object to delete