Skip to content

Commit ea18233

Browse files
authored
Merge pull request #19 from J-P-S-O/master
Master
2 parents 5d953c9 + 5f00980 commit ea18233

3 files changed

Lines changed: 17 additions & 8 deletions

File tree

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
# quickload
22
Quickload is a fast NodeJS app intended for the sharing of files between different computers in a fast manner. This way you can stop sending emails to yourself :).
3-
## Bugs
4-
The only current issue with the server is that binary files of all sorts (.png, .jpg, .docx, .pptx) get corrupted. This is under investigation.
3+
54
## How to use
65
```
7-
git clone https://github.com/J-P-S-O/quickload --branch v1.0.0
6+
git clone https://github.com/J-P-S-O/quickload --branch v1.0.1
7+
88
cd quickload
99
npm i
1010
node run.js
1111
```
12+
13+
14+
After this, access https://localhost:80 (You can use ngrok to generate public URLs).
15+
1. Click "Upload File" and select a file
16+
2. Save (or remember) the code alerted in the browser window
17+
3. Download the file on another machine by inserting the code in the text box and clicking "Download"
18+
1219
## Example command line log
1320
![image](https://user-images.githubusercontent.com/66487668/144876706-8caecd00-d241-4482-ac1b-05153698b485.png)

run.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ With love,
55
- @J-P-S-O (Octopus)
66
*/
77

8-
8+
console.clear()
99
let mime = require('mime-types')
1010
let prompt = require("prompt-sync")()
1111
let fs = require("fs")
@@ -89,13 +89,14 @@ const requestListener = function (req, res) {
8989
}else if(String(req.url).split("?")[0]==="/upload"){
9090
console.log("[UPLOAD STARTED]")
9191
//console.log("upload")
92-
let body = "";
92+
let body = [];
9393
req.on("data",(chunk)=>{
9494
//console.log(String(chunk))
95-
body += chunk
95+
body.push(chunk)
9696

9797
})
9898
req.on("end",()=>{
99+
body = Buffer.concat(body)
99100
res.writeHead(200, { "Content-Type": "text/plain" });
100101
res.end("Success: your code is "+ intcode);
101102
//console.log(req.headers)

static/start.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,21 @@ upbutton.onchange = function(e){
1414

1515
reader.onload = function(e) {
1616
console.log(reader.result)
17+
console.log(new Blob([reader.result]).size)
1718
console.log(file.type)
1819
console.log(file.name)
1920
let xhr = new XMLHttpRequest()
2021
xhr.open('POST', '/upload')
2122
xhr.setRequestHeader('Content-Type', file.type);
22-
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
2323
xhr.send(reader.result)
2424
xhr.onload = () => {
2525
window.alert(xhr.responseText);
2626

2727
}
2828
}
2929

30-
reader.readAsBinaryString(file);
30+
//reader.readAsBinaryString(file);
31+
reader.readAsArrayBuffer(file);
3132

3233

3334

0 commit comments

Comments
 (0)