@@ -52,7 +52,13 @@ $ npm install tus-node-server
5252
5353## Quick Start
5454
55- #### Build a standalone server
55+ #### Use the [tus- node- deploy](https: // hub.docker.com/r/bhstahl/tus-node-deploy/) Docker image
56+
57+ ` ` ` sh
58+ $ docker run -p 49160:8080 -d bhstahl/tus-node-deploy
59+ ` ` `
60+
61+ #### Build a standalone server yourself
5662` ` ` js
5763const tus = require('tus-node-server');
5864
@@ -68,7 +74,7 @@ server.listen({ host, port }, () => {
6874});
6975` ` `
7076
71- #### Alternatively, you could deploy tus-node-server as [Express Middleware](http://expressjs.com/en/guide/using-middleware.html)
77+ #### Use tus-node-server as [Express Middleware](http://expressjs.com/en/guide/using-middleware.html)
7278
7379` ` ` js
7480const tus = require (' tus-node-server' );
@@ -84,100 +90,14 @@ app.all('/files/*', function(req, res) {
8490app .listen (port, host);
8591` ` `
8692
87- #### Run the server
88- ` ` ` bash
89- $ node server .js
90- ` ` `
91-
92-
93- #### Quick Upload
94- ` ` ` bash
95- $ curl - X POST - I ' http://localhost:8000/files' \
96- - H ' Tus-Resumable: 1.0.0' \
97- - H ' Upload-Length: 12345678'
98-
99- HTTP / 1.1 201 Created
100- Tus- Resumable: 1.0 .0
101- Location : http: // localhost:8000/files/2d70739670d3304cbb8d3f2203857fef
102-
103- $ curl - X PATCH - I ' http://localhost:8000/files/2d70739670d3304cbb8d3f2203857fef' \
104- - H ' Tus-Resumable: 1.0.0' \
105- - H ' Upload-Offset: 0' \
106- - H ' Content-Type: application/offset+octet-stream' \
107- -- upload- file path/ to/ file .mp4
108-
109- HTTP / 1.1 201 Created
110- Tus- Resumable: 1.0 .0
111- Upload- Offset: 613858
112- ` ` `
113-
114-
115- #### Resumable Upload
116- ` ` ` bash
117-
118- # Start with 617379340 byte file
119- $ ls - ln
120- - rw- r-- r-- @ 1 1369348960 1355554294 617379340 May 5 17 : 31 file .mp4
121-
122- # Split it into two chunks
123- $ split - b 400000000 file .mp4 partial_file
124- - rw- r-- r-- 1 1369348960 1355554294 400000000 May 5 17 : 51 partial_fileaa
125- - rw- r-- r-- 1 1369348960 1355554294 217379340 May 5 17 : 51 partial_fileab
126-
127- # Create the endpoint via POST
128- $ curl - X POST - I ' http://localhost:8000/files' \
129- - H ' Tus-Resumable: 1.0.0' \
130- - H ' Upload-Length: 617379340'
131-
132- HTTP / 1.1 201 Created
133- Tus- Resumable: 1.0 .0
134- Location : http: // localhost:8000/files/88473063b1a06f11e2eced7983d4ab2e
135-
136- # Upload the first partial file
137- $ curl - X PATCH - I ' http://localhost:8000/files/88473063b1a06f11e2eced7983d4ab2e' \
138- - H ' Tus-Resumable: 1.0.0' \
139- - H ' Upload-Offset: 0' \
140- - H ' Content-Type: application/offset+octet-stream' \
141- - T partial_fileaa
142- HTTP / 1.1 204 No Content
143- Tus- Resumable: 1.0 .0
144- Upload- Offset: 400000000
145-
146-
147- # Check how much has been uploaded
148- $ curl - X HEAD - I ' http://localhost:8000/files/88473063b1a06f11e2eced7983d4ab2e' \
149- - H ' Tus-Resumable: 1.0.0'
150- HTTP / 1.1 200 OK
151- Tus- Resumable: 1.0 .0
152- Upload- Offset: 400000000
153- Upload- Length: 617379340
154-
155-
156- # Resume the upload with the second partial file
157- $ 11curl - X PATCH - I ' http://localhost:8000/files/88473063b1a06f11e2eced7983d4ab2e' \
158- - H ' Tus-Resumable: 1.0.0' \
159- - H ' Upload-Offset: 400000000' \
160- - H ' Content-Type: application/offset+octet-stream' \
161- - T partial_fileab
162- HTTP / 1.1 204 No Content
163- Tus- Resumable: 1.0 .0
164- Upload- Offset: 617379340
165-
166- # Check how much has been uploaded
167- $ curl - X HEAD - I ' http://localhost:8000/files/88473063b1a06f11e2eced7983d4ab2e' \
168- - H ' Tus-Resumable: 1.0.0'
169- HTTP / 1.1 200 OK
170- Tus- Resumable: 1.0 .0
171- Upload- Offset: 617379340
172- Upload- Length: 617379340
173- ` ` `
93+ ## Development
17494
175- ## Running Tests
95+ ##### Start up the demo using the FileStore
17696` ` ` bash
177- $ npm test
97+ $ npm run demo
17898` ` `
17999
180- ## Update Coverage
100+ ##### Start up the demo using the GCSDataStore
181101` ` ` bash
182- $ npm run coveralls
102+ $ npm run gcs_demo
183103` ` `
0 commit comments