nanome.api.files.models module

class Files(plugin_instance)[source]

Bases: object

Class to navigate through files and directories on the machine running Nanome using unix-like filesystem methods.
cd(directory, callback=None)[source]
changes the current working directory
Parameters:
  • directory (str) – directory to change to
  • callback (method (FileError) -> None) – called when operation has completed, potentially with errors
cp(source, dest, callback=None)[source]
Copy source to dest
Parameters:
  • source (str) – the Nanome machine filename of the file to copy
  • dest (str) – the Nanome machine filename to copy to
  • callback (method (FileError) -> None) – called when operation has completed, potentially with errors
get(source, dest, callback=None)[source]
Gets file source from the Nanome session’s machine and writes to dest of the plugin machine.
Parameters:
  • source (str) – Nanome machine filename of the file to move
  • dest (str) – plugin machine filename for the file’s destination
  • callback (method (FileError, str) -> None) – called when operation has completed, with dest and any potential errors
ls(directory, callback=None)[source]
list directory’s contents
Parameters:
  • directory (str) – directory to request
  • callback (method (FileError, list of FileMeta) -> None) – function that will be called with contents of the directory
mkdir(target, callback=None)[source]
Create all directories along the path provided
Parameters:
  • target (str) – pathname of the final directory to create
  • callback (method (FileError) -> None) – called when operation has completed, potentially with errors
mv(source, dest, callback=None)[source]
Rename source to dest, or move source into directory dest/
Parameters:
  • source (str) – file to move or rename
  • dest (str) – file or pathname of the file’s destination
  • callback (method (FileError) -> None) – called when operation has completed, potentially with errors
put(source, dest, callback=None)[source]
Send the file source on the plugin machine to be placed at dest on the Nanome session’s machine.
Parameters:
  • source (str) – plugin machine filename of the file to send
  • dest (str) – Nanome machine filename for the file’s destination
  • callback (method (FileError) -> None) – called when operation has completed, potentially with errors
pwd(callback=None)[source]
Print the absolute path of the current working directory
Parameters:callback (method (FileError, str) -> None) – function that will be called with the full working directory path
rm(target, callback=None)[source]
remove non-directory file
Parameters:
  • target (str) – filepath of Nanome machine file to remove.
  • callback (method (FileError) -> None) – called when operation has completed, potentially with errors
rmdir(target, callback=None)[source]
remove directory
Parameters:
  • target (str) – Nanome machine directory to remove.
  • callback (method (FileError) -> None) – called when operation has completed, potentially with errors