• Jim Mussared's avatar
    tools/pyboard.py: Add fs_{listdir,readfile,writefile,stat}. · aa642806
    Jim Mussared authored
    These are for working with the filesystem when using pyboard.py as a
    library, rather than at the command line.
    
    - fs_listdir returns a list of tuples, in the same format as os.ilistdir().
    - fs_readfile returns the contents of a file as a bytes object.
    - fs_writefile allows writing a bytes object to a file.
    - fs_stat returns an os.statresult.
    
    All raise FileNotFoundError (or OSError(ENOENT) on Python 2) if the file is
    not found (or PyboardError on other errors).
    
    Updated fs_cp and fs_get to use fs_stat to compute file size.
    
    This work was funded through GitHub Sponsors.
    Signed-off-by: default avatarJim Mussared <jim.mussared@gmail.com>
    aa642806
pyboard.py 29.7 KB