Filesystem access
Skills have access to both persistent and temporary namespaced filesystems independent of the Skill's root directory.
Persistent Files
Reading and writing to files
def write_line_to_file(self, file_name, line):
"""Write a single line to a file in the Skills persistent filesystem."""
with self.file_system.open(file_name, "w") as my_file:
my_file.write(line)
def read_file(self, file_name):
"""Read the contents of a file in the Skills persistent filesystem."""
with self.file_system.open(file_name, "r") as my_file:
return my_file.read()Check if a file exists
Get the path of the namespaced directory.
Create subdirectories
Example Skill
Temporary Cache
Example Skill
Skill Root Directory
Last updated
Was this helpful?