gofs

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2024 License: MIT Imports: 8 Imported by: 0

README

Welcome to gofs 👋

GitHub tag (with filter) GitHub Workflow Status (with event) GitHub License GitHub go.mod Go version (subdirectory of monorepo)

This is a simple fileserver tool to expose a file or directory locally. The tool also has the option to rebind the url to a different path when exposing. It is written in Go.

Install

go get github.com/floholz/gofs

Usage

To expose the current directory, simply run the package. By default, the directory will be exposed at http://localhost:8080/

go run github.com/floholz/gofs

Instead of the active directory, you can choose a file or directory to expose by passing it as an argument.

go run github.com/floholz/gofs ~/my-direcory/my-file.txt

To set the url, your file or directory should be exposed to, use the --url or -u flag.

go run github.com/floholz/gofs ~/my-direcory/my-file.txt --url 0.0.0.0:3003/path-to-file/file.json

By leaving the hostname, port or path empty, it will be set to its default value.

URL part default value
scheme is always set to http:
hostname localhost
port 8080
path (directory) /
path (file) /filename.ext
Examples for --url parsing
argument --url value result
~/my-dir/ http://localhost:8080/
~/my-dir/file.txt http://localhost:8080/file.txt
~/my-dir/ 192.168.0.10 http://192.168.0.10:8080/
~/my-dir/ 192.168.0.10:1234 http://192.168.0.10:1234/
~/my-dir/ 192.168.0.10:1234/custom/path/ http://192.168.0.10:1234/custom/path/
~/my-dir/file.txt :1234 http://localhost:1234/file.txt
~/my-dir/file.txt :1234/path/to-file.json http://localhost:1234/path/to-file.json
~/my-dir/ /custom/path/ http://localhost:8080/custom/path/

🤝 Contributing

Contributions, issues and feature requests are welcome!

Feel free to check issues page.

📝 License

Copyright © 2024 floholz.

This project is MIT licensed.


Show your support

Give a ⭐ if this project helped you!

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL