Share your files with people next to you without having to send them under the ocean and back again.
Na allows you to easily share files over a local network by serving the current working directory through HTTP.
na [OPTIONS]
Navigate to a directory that you wish to share and run na. Once it's running,
you'll be able to access the files from that directory from any device that's on the same network and has
a web browser (or something that understands HTTP).
-h | --help display help and exit
-d | --dir [PATH] specifies the path of the served directory (default is the working directory)
-p | --port [PORT] specifies the port number (default 8888)
-i | --interface [INTERFACE] specify the network interface to use (eg. `eth0`, `wlo0`, `localhost`, etc...)
-r | --enable-delete enables file deletions through DELETE requests (disabled by default)
-u | --disable-upload disables file uploads (enabled by default)
-s | --show-directory show the path of the served directory to client (disabled by default)
-l | --list-interfaces print a list of available network interfaces and exit
-o | --overwrite-file if enabled, uploaded files will overwrite existing files with the same name (disabled by default)
-6 | --ipv6 prefer IPv6 if available
-v | --verbose verbose output
Lists of available resources can be obtained either in JSON at /json, or
in a simple list form separated by a newline \n at /list.
curl -X GET http://127.0.0.1:9000/json
[
{
"name": ".cargo-lock",
"url": "/files/.cargo-lock",
"size": 0,
"modified": "Tue, Aug 02 2016 02:08:53",
"modified_raw": 1470096533
},
{
"name": "na",
"url": "/files/na",
"size": 18404960,
"modified": "Wed, Aug 03 2016 04:36:33",
"modified_raw": 1470191793
}
]
curl -X GET http://127.0.0.1:9000/list
/files/.cargo-lock
/files/na
curl -X GET "http://127.0.0.1:9000/files/example.txt"
curl --form "[email protected]" http://127.0.0.1:9000
[
{
"source_name": "README.md",
"saved_name": "README.md"
}
]curl -F "upload[][email protected]" -F "upload[][email protected]" http://127.0.0.1:9000
[
{
"source_name": "README.md",
"saved_name": "README.md (1)"
},
{
"source_name": "build.rs",
"saved_name": "build.rs"
}
]Deleting a file:
curl -X DELETE "http://127.0.0.1:9000/files/example.txt"
note: DELETE is disabled by default, so it needs to be enabled by passing the -r or --enable-delete flag to na
Download na:
sudo curl -L https://github.com/srdja/na/releases/download/v0.2.0/na-linux64 -o /usr/local/bin/na
Make na readable and executable for all users:
sudo chmod a+rx /usr/local/bin/na
Download na:
sudo curl -L https://github.com/srdja/na/releases/download/v0.2.0/na-osx -o /usr/local/bin/na
Make na readable and executable for all users:
sudo chmod a+rx /usr/local/bin/na
Download the na executable and place
it into a directory that you wish to share, or you can put it into a directory that's in your PATH if you
wish to use it from the command line.
Currently Rust nightly is required to build the project.
- Build debug with
cargo build - Build release with
cargo build --release
GPLv3+
If you have a feature request, or have found a bug, feel free to open a new issue.
To get started, fork the repo to your account and then clone your fork:
git clone https://github.com/yourusername/na.gitOnce you're done making changes, commit your work and push it to your fork. You can then open a pull request from your fork to the upstream repository.
