HF_AGENT / hffs_ops.py
Brettapps's picture
Syncing files from local MCP agent storage
5da5531 verified
Raw
History Blame Contribute Delete
565 Bytes
from huggingface_hub import hffs
def hffs_write_file(path: str, content: str):
"""Writes content to a file on HFFS."""
with hffs.open(path, "w") as f:
f.write(content)
def hffs_copy_file(src: str, dst: str):
"""Copies a file on HFFS."""
hffs.cp(src, dst)
def hffs_remove_file(path: str):
"""Removes a file on HFFS."""
hffs.rm(path)
def hffs_list_dir(path: str):
"""Lists files in a directory on HFFS."""
return hffs.ls(path)
def hffs_glob_files(pattern: str):
"""Glob files on HFFS."""
return hffs.glob(pattern)