-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
30 lines (27 loc) · 961 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const fetch = require("node-fetch");
const readline = require("readline");
const fs = require("fs");
const json = require("big-json");
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
});
var test = async () => {
var body = JSON.stringify({
to: "login",
data: { email: "ciaobello", hashPassword: "148de9c5a7a44d19e56cd9ae1a554bf67847afb0c58f6e12fa29ac7ddfca9940" },
});
var loginData;
await fetch("http://localhost:8080", { method: "POST", body: body })
.then((data) => data.json())
.then((json) => (loginData = json));
console.log(loginData.SessionId);
body = fs.readFileSync("tmp.mp4");
fetch("http://localhost:8080?to=fileManager&method=getFile&filename=Exercise-91.mp4", {
method: "GET",
})
.then((data) => data.buffer())
.then((data) => console.log(data));
console.log("end");
};
test();