SFTPFile(AbstractBufferedFile) for sparse access to remote file over ssh
See original GitHub issueRef: https://github.com/fsspec/filesystem_spec/issues/748 which I found while also wondering about AttributeError: 'SFTPFile' object has no attribute 'blocksize'
error 😉
I guess there is no “sparse” cache due to not implemented “range” request support for sftp as it is done for e.g. HTTPFile?
But it seems that sftp itself does allow for range requests, e.g.:
$> curl --silent --range 0-0,-1 sftp://yoh@secret.datalad.org:2222/home/yoh/c4057c5e-7af5-4370-878f-ccfc971aeba4 | hexdump
0000000 0089
0000001
so I guess it should be well be possible provide such support in fsspec… didn’t look in detail yet anywhere but paramiko does seems to support the seekable BufferedFile
$> git grep -p 'def seek'
paramiko/_winapi.py=class MemoryMap(object):
paramiko/_winapi.py: def seek(self, pos):
paramiko/file.py=class BufferedFile(ClosingContextManager):
paramiko/file.py: def seekable(self):
paramiko/file.py: def seek(self, offset, whence=0):
paramiko/sftp_file.py=class SFTPFile(BufferedFile):
paramiko/sftp_file.py: def seekable(self):
paramiko/sftp_file.py: def seek(self, offset, whence=0):
so may be it is really just a quick patch away? 😉
Issue Analytics
- State:
- Created a year ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
How To Use SFTP to Securely Transfer Files with a Remote ...
SFTP is a secure way to transfer files between local and remote servers. ... Test SSH access with the following command:.
Read more >API Reference — fsspec 2022.11.0+13.g0974514.dirty ...
This class implements chunk-wise local storage of remote files, for quick access after the initial download. The files are stored in a given...
Read more >How to allow SSH session to linux server but, do not allow ...
We allow SSH access to admins along with SFTP file transfer access using PAM. Now unique case is to grant SSH session to...
Read more >Using SFTP for Remote File Transfer from the Command Line
The SSH File Transfer Protocol allows you to transfer files from the command line via SSH between a local computer and a specified...
Read more >Net::SFTP::Foreign - SSH File Transfer Protocol client
The security in SFTP comes through its integration with SSH, ... Blocks that are all zeros are skipped possibly creating an sparse file...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @efiop! Indeed long time. I really hope you are doing ok.
Ran into https://github.com/ronf/asyncssh/issues/504 so had to move aside my ~/.ssh and tune up my ugly quick script to ask for password
The script with which I am "exploring" the fsspec on a type of files in interest
and running it results in
so it stalls after traceback and requires Ctrl-C it. If you need a sample of that file to try exactly that script – it is this one https://dandiarchive.s3.amazonaws.com/blobs/c40/57c/c4057c5e-7af5-4370-878f-ccfc971aeba4 . versions of fsspec and sshfs and asyncssh AFAIK are all “bleeding edge from github”. FWIW:
BTW – just to make sure – having installed (and imported)
sshfs
does not automagically makesshfs
known forfsspec.registry.known_implementations
and available forfsspec.filesystem
right? (I would have assumed it would through some entrypoint or alike)