Commit 8484c28e authored by Matthias Weidenthaler's avatar Matthias Weidenthaler
Browse files

Added 'info' function to get file or folder metadata

parent 3891ad2c
...@@ -47,6 +47,9 @@ s3_fs.get('s3://csst-prod/gaia/test/requirements.txt', 'requirements.txt', s3_op ...@@ -47,6 +47,9 @@ s3_fs.get('s3://csst-prod/gaia/test/requirements.txt', 'requirements.txt', s3_op
# folder # folder
s3_fs.get('s3://csst-prod/gaia/data', './', recursive=True) s3_fs.get('s3://csst-prod/gaia/data', './', recursive=True)
s3_fs.get('s3://csst-prod/gaia/data', './', s3_options=s3_options, recursive=True) s3_fs.get('s3://csst-prod/gaia/data', './', s3_options=s3_options, recursive=True)
# get file or folder info
s3_fs.info('s3://csst-prod/gaia/data')
s3_fs.info('s3://csst-prod/gaia/test/requirements.txt', s3_options=s3_options)
``` ```
## astropy直接读写s3的写法适配 ## astropy直接读写s3的写法适配
......
...@@ -7,4 +7,8 @@ def put(lpath, rpath, recursive=False, callback=fsspec.callbacks.DEFAULT_CALLBAC ...@@ -7,4 +7,8 @@ def put(lpath, rpath, recursive=False, callback=fsspec.callbacks.DEFAULT_CALLBAC
def get(rpath, lpath, recursive=False, callback=fsspec.callbacks.DEFAULT_CALLBACK, maxdepth=None, s3_options=load_s3_options(), **kwargs,): def get(rpath, lpath, recursive=False, callback=fsspec.callbacks.DEFAULT_CALLBACK, maxdepth=None, s3_options=load_s3_options(), **kwargs,):
s3_fs = fsspec.filesystem('s3', **s3_options) s3_fs = fsspec.filesystem('s3', **s3_options)
s3_fs.get(rpath, lpath, recursive, callback, maxdepth, **kwargs) s3_fs.get(rpath, lpath, recursive, callback, maxdepth, **kwargs)
\ No newline at end of file
def info(path, bucket=None, key=None, refresh=False, version_id=None, s3_options=load_s3_options()) -> dict:
s3_fs = fsspec.filesystem('s3', **s3_options)
return s3_fs.info(path, bucket, key, refresh, version_id)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment