Skip to content

Commit 2ef160c

Browse files
author
srdja
committed
Updating README.md
1 parent bc4d451 commit 2ef160c

File tree

2 files changed

+163
-9
lines changed

2 files changed

+163
-9
lines changed

README.md

+163-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,169 @@
1-
# na
1+
# Na
2+
> Share your files with people next to you without having to send them under the ocean and back again.
23
4+
[![Build Status](https://travis-ci.org/srdja/na.svg?branch=master)](https://travis-ci.org/srdja/na)
5+
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0)
6+
7+
**Na** allows you to easily share files over a local network by serving the current working directory through HTTP.
38

4-
Share files with people next to you without having to send them under the ocean or into space and back again.
9+
## Usage
510

11+
```
12+
na [OPTIONS]
13+
```
614

7-
### Usage
8-
1. Place the `na` executable into a directory that you would like to share with your local network
9-
2. Run `na`
1015

11-
Once it's running, others will be able to access that directory through a web page and download/upload files
12-
from it.
16+
Navigate to a directory that you wish to share and run `na`. Once it's running,
17+
you'll be able to access the files from that directory from any device that's on the same network and has
18+
a web browser (or something that understands HTTP).
1319

14-
#### Building the project
15-
`cargo build`
20+
21+
![demo](demo.gif)
22+
23+
24+
## Options
25+
```
26+
-h | --help display help and exit
27+
-d | --dir [PATH] specifies the path of the served directory (default is the working directory)
28+
-p | --port [PORT] specifies the port number (default 8888)
29+
-i | --interface [INTERFACE] specify the network interface to use (eg. `eth0`, `wlo0`, `localhost`, etc...)
30+
-r | --enable-delete enables file deletions through DELETE requests (disabled by default)
31+
-u | --disable-upload disables file uploads (enabled by default)
32+
-s | --show-directory show the path of the served directory to client (disabled by default)
33+
-l | --list-interfaces print a list of available network interfaces and exit
34+
-o | --overwrite-file if enabled, uploaded files will overwrite existing files with the same name (disabled by default)
35+
-6 | --ipv6 prefer IPv6 if available
36+
-v | --verbose verbose output
37+
```
38+
39+
40+
## Using Na without a browser
41+
42+
#### Obtaining a list of available files
43+
44+
Lists of available resources can be obtained either in JSON at `/json`, or
45+
in a simple list form separated by a newline `\n` at `/list`.
46+
47+
48+
##### An example of obtaining a list of files in JSON form:
49+
```
50+
curl -X GET http://127.0.0.1:9000/json
51+
```
52+
53+
54+
```json
55+
[
56+
{
57+
"name": ".cargo-lock",
58+
"url": "/files/.cargo-lock",
59+
"size": 0,
60+
"modified": "Tue, Aug 02 2016 02:08:53",
61+
"modified_raw": 1470096533
62+
},
63+
{
64+
"name": "na",
65+
"url": "/files/na",
66+
"size": 18404960,
67+
"modified": "Wed, Aug 03 2016 04:36:33",
68+
"modified_raw": 1470191793
69+
}
70+
]
71+
72+
```
73+
74+
##### An example of obtaining a simple list of URLs separated by a newline `\n`:
75+
```
76+
curl -X GET http://127.0.0.1:9000/list
77+
```
78+
79+
```
80+
/files/.cargo-lock
81+
/files/na
82+
```
83+
84+
##### Fetching a file:
85+
```
86+
curl -X GET "http://127.0.0.1:9000/files/example.txt"
87+
```
88+
89+
##### Uploading a single file:
90+
```
91+
curl --form "upload=@example.txt" http://127.0.0.1:9000
92+
```
93+
```json
94+
[
95+
{
96+
"source_name": "README.md",
97+
"saved_name": "README.md"
98+
}
99+
]
100+
```
101+
102+
##### Uploading multiple files in a single request:
103+
```
104+
curl -F "upload[]=@example.txt" -F "upload[]=@example2.txt" http://127.0.0.1:9000
105+
```
106+
```json
107+
[
108+
{
109+
"source_name": "README.md",
110+
"saved_name": "README.md (1)"
111+
},
112+
{
113+
"source_name": "build.rs",
114+
"saved_name": "build.rs"
115+
}
116+
]
117+
```
118+
119+
Deleting a file:
120+
```
121+
curl -X DELETE "http://127.0.0.1:9000/files/example.txt"
122+
```
123+
**note**: `DELETE` is disabled by default, so it needs to be enabled by passing the `-r` or `--enable-delete` flag to `na`
124+
125+
126+
## Installation
127+
128+
#### Linux
129+
Download **na**:
130+
```
131+
sudo curl -L https://github.com/srdja/na/releases/download/v0.2.0/na-linux64 -o /usr/local/bin/na
132+
```
133+
134+
Make **na** readable and executable for all users:
135+
```
136+
sudo chmod a+rx /usr/local/bin/na
137+
```
138+
139+
#### Windows
140+
Download the **na** [executable](https://github.com/srdja/na/releases/download/v0.2.0/na-win64.exe) and place
141+
it into a directory that you wish to share, or you can put it into a directory that's in your `PATH` if you
142+
wish to use it from the command line.
143+
144+
## Building the project
145+
146+
Currently Rust [nightly](https://www.rust-lang.org/en-US/downloads.html) is required to build the project.
147+
148+
- Build debug with `cargo build`
149+
- Build release with `cargo build --release`
150+
151+
152+
## License
153+
GPLv3+
154+
155+
156+
## Contributing
157+
158+
##### Bugs and Features
159+
160+
If you have a feature request, or have found a bug, feel free to open a [new issue](https://github.com/srdja/na/issues/new).
161+
162+
##### Pull Requests
163+
164+
To get started, fork the repo to your account and then clone your fork:
165+
```bash
166+
git clone https://github.com/yourusername/na.git
167+
```
168+
Once you're done making changes, commit your work and push it to your fork.
169+
You can then open a [pull request](https://help.github.com/articles/using-pull-requests/) from your fork to the upstream repository.

demo.gif

1.38 MB
Loading

0 commit comments

Comments
 (0)