2013-03-17 09:47:14 +00:00
|
|
|
# tusd
|
2013-03-16 21:23:25 +00:00
|
|
|
|
2013-03-16 23:32:37 +00:00
|
|
|
A dedicated server for resumable file uploads written in Go.
|
2013-03-16 21:23:25 +00:00
|
|
|
|
2013-03-16 23:36:51 +00:00
|
|
|
Sounds interesting? Get notified when it's ready: http://tus.io/
|
|
|
|
|
2013-03-16 21:25:33 +00:00
|
|
|
## Roadmap
|
|
|
|
|
2013-03-16 21:23:25 +00:00
|
|
|
The goal for this code base is to come up with a good and simple solution for
|
|
|
|
resumable file uploads over http.
|
|
|
|
|
2013-03-16 23:49:13 +00:00
|
|
|
* Defining a good http API (in progress)
|
2013-03-16 23:39:08 +00:00
|
|
|
* Implementing a minimal / robust server for it
|
2013-03-16 21:25:33 +00:00
|
|
|
* Creating an HTML5 client
|
2013-03-16 21:23:25 +00:00
|
|
|
* Setting up an online demo
|
|
|
|
* Integrating Amazon S3 for storage
|
|
|
|
* Creating an iOS client
|
|
|
|
* Collect feedback
|
|
|
|
|
|
|
|
After this, and based on the feedback, we will continue the development, and
|
|
|
|
start to offer the software as a hosted service. All code will continue to be
|
|
|
|
released as open source, there will be no bait and switch.
|
|
|
|
|
2013-03-16 23:32:37 +00:00
|
|
|
## HTTP API
|
|
|
|
|
2013-03-17 09:41:17 +00:00
|
|
|
Below is the proposed HTTP API for resumable file uploading.
|
|
|
|
|
|
|
|
Prior art:
|
2013-03-17 09:40:12 +00:00
|
|
|
|
|
|
|
* [Resumable Media Uploads in the Google Data Protocol](https://developers.google.com/gdata/docs/resumable_upload)
|
|
|
|
* [Google Drive - Upload Files](https://developers.google.com/drive/manage-uploads)
|
|
|
|
* [ResumableHttpRequestsProposal from Gears](http://code.google.com/p/gears/wiki/ResumableHttpRequestsProposal)
|
|
|
|
|
2013-03-16 23:44:23 +00:00
|
|
|
### POST /files
|
2013-03-16 23:32:37 +00:00
|
|
|
|
|
|
|
**Request**
|
|
|
|
|
|
|
|
```
|
|
|
|
POST /files HTTP/1.1
|
|
|
|
Host: tus.example.com
|
|
|
|
Content-Length: 0
|
|
|
|
Content-Range: bytes */100
|
|
|
|
Content-Type: "image/png"
|
|
|
|
```
|
|
|
|
|
|
|
|
**Response:**
|
|
|
|
|
|
|
|
```
|
|
|
|
HTTP/1.1 201 Created
|
|
|
|
Location: http://tus.example.com/files/123d3ebc995732b2
|
|
|
|
```
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"id": "123d3ebc995732b2",
|
|
|
|
"url": "http://tus.example.com/files/123d3ebc995732b2",
|
|
|
|
"received": 0,
|
|
|
|
"size": 0,
|
|
|
|
"parts": []
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
2013-03-16 23:45:01 +00:00
|
|
|
### PUT /files/\<id\>
|
2013-03-16 23:42:41 +00:00
|
|
|
|
|
|
|
**Request:**
|
|
|
|
```
|
|
|
|
PUT /files/123d3ebc995732b2 HTTP/1.1
|
|
|
|
Host: tus.example.com
|
|
|
|
Content-Length: 100
|
|
|
|
Content-Range: bytes 0-99/100
|
|
|
|
```
|
|
|
|
```
|
|
|
|
[bytes 0-99]
|
|
|
|
```
|
|
|
|
|
|
|
|
**Response:**
|
|
|
|
```
|
|
|
|
HTTP/1.1 200 Ok
|
|
|
|
```
|
|
|
|
|
2013-03-16 23:44:23 +00:00
|
|
|
### GET /files/123d3ebc995732b2
|
2013-03-16 23:32:37 +00:00
|
|
|
|
|
|
|
**Request:**
|
|
|
|
```
|
|
|
|
GET /files/123d3ebc995732b2/d930cc9d304cc667 HTTP/1.1
|
|
|
|
Host: tus.example.com
|
|
|
|
Content-Length: 0
|
|
|
|
```
|
|
|
|
|
2013-03-16 23:42:41 +00:00
|
|
|
The server responds by informing the client about the state of the file upload
|
2013-03-16 23:32:37 +00:00
|
|
|
upload:
|
|
|
|
|
|
|
|
```
|
2013-03-16 23:42:41 +00:00
|
|
|
{
|
|
|
|
"id": "123d3ebc995732b2",
|
|
|
|
"received": 0,
|
|
|
|
"size": 0,
|
|
|
|
"parts": []
|
|
|
|
}
|
2013-03-16 23:32:37 +00:00
|
|
|
```
|
|
|
|
|
2013-03-16 21:23:25 +00:00
|
|
|
## License
|
|
|
|
|
|
|
|
This project is licensed under the AGPL v3.
|
|
|
|
|
|
|
|
```
|
|
|
|
Copyright (C) 2013 Transloadit Limited
|
|
|
|
http://transloadit.com/
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU Affero General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU Affero General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
```
|