Skip to content

Commit

Permalink
specify get_file for RsConnectFs
Browse files Browse the repository at this point in the history
  • Loading branch information
isabelizimm committed Dec 12, 2023
1 parent bd7055d commit 0ea84ad
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pins/rsconnect/fs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from pathlib import Path

from fsspec import AbstractFileSystem
from fsspec.utils import isfilelike

from typing import Sequence

Expand Down Expand Up @@ -277,6 +278,14 @@ def get(self, rpath, lpath, recursive=False, *args, **kwargs) -> None:
bundle["content_guid"], bundle["id"], parsed.file_name, lpath
)

def get_file(self, rpath, lpath, **kwargs):
data = self.cat_file(rpath, **kwargs)
if isfilelike(lpath):
lpath.write(data)
else:
with open(lpath, "wb") as f:
f.write(data)

def exists(self, path: str, **kwargs) -> bool:
try:
self.info(path)
Expand Down

0 comments on commit 0ea84ad

Please sign in to comment.