Skip to content

Commit

Permalink
update fsPath
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaaaaaaty committed Oct 17, 2017
1 parent d32263d commit 0453abe
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 123 deletions.
Binary file modified .DS_Store
Binary file not shown.
36 changes: 36 additions & 0 deletions flvProxy/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
const http = require('http')
const superagent = require('superagent')
const fs = require('fs')
let server = http.createServer((req, res) => {
var realpath = './stream-98.flv';
console.log(123)
res.setHeader("Content-Type", 'video/x-flv');
res.setHeader("Access-Control-Allow-Origin", '*')
res.setHeader('Content-type','application/octet-stream')
res.setHeader('Content-Disposition', 'attachment; filename=test.flv' )
var stats = fs.statSync(realpath);
if (req.headers["range"]) {
console.log(req.headers["range"])
var range = utils.parseRange(req.headers["range"], stats.size);
console.log(range)
if (range) {
res.setHeader("Content-Range", "bytes " + range.start + "-" + range.end + "/" + stats.size);
res.setHeader("Content-Length", (range.end - range.start + 1));
var stream = fs.createReadStream(realpath, {
"start": range.start,
"end": range.end
});

res.writeHead('206', "Partial Content");
stream.pipe(res);
} else {
res.removeHeader("Content-Length");
res.writeHead(416, "Request Range Not Satisfiable");
res.end();
}
} else {
var stream = fs.createReadStream(realpath);
res.writeHead('200', "Partial Content");
stream.pipe(res);
}
}).listen(4000)
Binary file added flvProxy/stream-98.flv
Binary file not shown.
Binary file added flvProxy/test.flv
Binary file not shown.
Binary file modified fsPathSys/.DS_Store
Binary file not shown.
13 changes: 0 additions & 13 deletions fsPathSys/files/ip__t_1507903715635/test.html

This file was deleted.

13 changes: 0 additions & 13 deletions fsPathSys/files/ip__t_1507903867692/test.html

This file was deleted.

13 changes: 0 additions & 13 deletions fsPathSys/files/ip__t_1507903883982/test.html

This file was deleted.

84 changes: 0 additions & 84 deletions fsPathSys/files/ip__t_1507904023655/test 2.html

This file was deleted.

6 changes: 6 additions & 0 deletions fsPathSys/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta charset="UTF-8">
<title>路径替换工具</title>
<link rel="stylesheet" href="http://apps.bdimg.com/libs/bootstrap/3.3.4/css/bootstrap.css">
<link rel="stylesheet" href="http://10.2.45.110:3044/id.html">
<style>
.wrapper {
width: 800px;
Expand Down Expand Up @@ -39,8 +40,13 @@
#result {
cursor: pointer;
}
.wechat-icon img{
width: 0;
height: 0;
}
</style>
</head>

<body>
<div class="wrapper">
<div class="page-header">
Expand Down
1 change: 1 addition & 0 deletions fsPathSys/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ function sendFile(filePath, res) {
}

function send404(res){
res.writeHead(404)
res.end("<h1 style='text-align:center'>404</h1><p style='text-align:center'>file not found</p>")
}
function send500(res){
Expand Down

0 comments on commit 0453abe

Please sign in to comment.