Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example for interacting with remote file servers #1061

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

RahulMohanK
Copy link

Pull Request Template

Description:

Additional Information:

  • This PR includes the usage of AddFileStore function to configure a remote file server in gofr and uses the api's available to interact with the remote directory.

Checklist:

  • I have formatted my code using goimport and golangci-lint.
  • All new code is covered by unit tests.
  • This PR does not decrease the overall code coverage.
  • I have reviewed the code comments and documentation for clarity.

Thank you for your contribution!

Copy link
Contributor

@srijan-27 srijan-27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests are failing, please check. Also while fixing please update the branch as well.

Comment on lines +1 to +5
HOST="localhost"
USER_NAME="anonymous"
PASSWORD="test"
PORT=21
REMOTE_DIR_PATH="/"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

configs ain't necessarily needed to pass within double quotes ("")

Comment on lines +16 to +22
To get the list of all directories or files in the given path of the configured remote file server

```
go run main.go ls -path=<path>

Eg:- go run main.go ls -path=/
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs refactoring, as it seems duplicate.. Also, in below snapshot please see that copy button will copy complete block to clipboard and it won't be useful for user. Ideally, we should only add required command reference, so user can just copy and change filePath.

Screenshot 2024-10-01 at 5 24 51 PM

func registerCreateFileCommand(app *gofr.App, fs file.FileSystemProvider) {
app.SubCommand("createfile", func(c *gofr.Context) (interface{}, error) {
fileName := c.Param("filename")
fmt.Printf("Creating file :%s", fileName)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't we use gofr logger instead of fmt.Printf?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Example for using interacting with files
2 participants