Comments (5)
Since the afero.Afero
interface uses afero.File
types, I’m not sure we want to implement it. We’ve already implemented the github.com/kr/fs.FileSystem interface, which has basically been superseded by the io/fs.FS
interface. I would view the implementation of the kr/fs.FileSystem
as a mistake, as it put an unnecessary external dependency on the package.
I don’t think anything is wrong with the interface they have, but since we would have to import the package in order to implement the interface, 😬 I’m wary of pulling in Yet Another File System Interface Abstraction Interface.
Instead, I would implement something similar but with our own File
type, and then anyone who is interested, can easily implement a compatibility layer, by converting our Client
calls to the Afero package interface. This would be the most appropriate path forward for what you’re suggesting.
from sftp.
How about implementing the handlers on fs.FS? That would be a read-only system, but do you think it would be appropriate to upstream?
We could provide a way to wrap that with write handlers on the existing interface.
from sftp.
Yes, implementing fs.FS
is the interface that we should be targetting as an exportable interface.
Ideally, Client
should have a receiver method FS() (io/fs.FS, error)
or maybe even just Sub(dir string) (io/fs.FS, error)
directly, that would fit the interface. It would have to be a wrapper, and it should only provide the functionality that io/fs.FS
expects, that is, it would be read-only. If someone needs write handlers, then they would need their own wrapper to meet whatever interface they’re using.
Implementing more than what io/fs.FS
expects, like providing say Create(name string) (io.WriteCloser, error)
is fraught with issues, in that if io/fs
ever does provide a definitive CreateFS
and we’re not meeting that interface, we couldn’t add a correct one, because it would collide with the Create
we already implement.
P.S. part of why I haven’t continued my work on the Start using filexfer
PR, is that we’re really at a point here, where we need to implement a v2.0.0 of the API, and clean up decisions made in the past in the name of expedience to provide a feature, but which ended up bringing us out of alignment with everyone else. As an example: OpenFile
doesn’t take a perm fs.FileMode
.
from sftp.
Would it make sense then to do a simpler server API as well? Seems like a lot of boilerplate when just an auth handler and FS are enough to run a full server.
from sftp.
Yeah, there’s a few design ideas there that could simplify a lot.
from sftp.
Related Issues (20)
- Question about getwd() method HOT 1
- IETF Link has rotted HOT 2
- mandatory workDir even for absolute paths HOT 1
- Unable to delete the selected user: Not Found HOT 3
- Change current working directory? HOT 2
- proposal/exposeRemoveFile HOT 2
- Request attributes are not being propagated for SSH_FXP_OPEN operation HOT 5
- Should Seek() io.SeekStart and io.SeekCurrent do the different things? HOT 1
- sftp client hang when exit in sftp server example HOT 2
- Connection lost when using library with limited bandwidth HOT 5
- In Windows, `Server` should allow a pseudo-directory for `/` which enumerates available drives HOT 22
- How can I perform sftp download and upload feature for multiple files at root directory and within nested subfolder using https://github.com/pkg/sftp HOT 3
- close file double time sometimes cause copy problem wh HOT 10
- how to handle binary and ascii file transfer to and from sftp server? HOT 1
- The performance of transferring file is bad HOT 1
- getting error while creating a client in a multithreaded usecase "Failed to create SFTP client: error receiving version packet from server: server unexpectedly closed connection: unexpected EOF" HOT 8
- Does this package Support z/OS (s390x) or not? HOT 2
- Performance is much slower than a Java implementation when running in z/OS HOT 5
- Proposal: Standardized FileInfo Structure. RE: z/OS performance investigation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sftp.