Repository: daspinola/video-stream-sample
Branch: master
Commit: 6fc26e7a1458
Files: 7
Total size: 3.5 KB
Directory structure:
gitextract_xbp5mana/
├── .gitignore
├── LICENSE
├── README.md
├── index.htm
├── package.json
├── public/
│ └── index.js
└── server.js
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
.DS_STORE
.vsCode/
node_modules
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2017 Diogo Santos
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
This is a basic sample of how to do video streaming using Node.js and HTML5
# Install
- git clone
- npm install
- npm start
- open browser in `localhost:3000`
================================================
FILE: index.htm
================================================
<html>
<head>
<title>Video stream sample</title>
</head>
<body>
<video id="videoPlayer" controls muted="muted" autoplay>
<source src="/video" type="video/mp4">
</video>
</body>
</html>
================================================
FILE: package.json
================================================
{
"name": "video-stream-sample",
"version": "1.0.0",
"description": "Streaming video example",
"main": "server.js",
"engines": {
"node": ">=6.2.0"
},
"scripts": {
"start": "nodemon server.js"
},
"author": "daspinola",
"license": "MIT",
"dependencies": {
"express": "^4.15.3",
"nodemon": "^1.11.0"
}
}
================================================
FILE: public/index.js
================================================
document.addEventListener('DOMContentLoaded', init, false);
/**
* You can manipulate the video here
* For example: Uncomment the code below and in the index to get a Start/Stop button
*/
function init() {
// const VP = document.getElementById('videoPlayer')
// const VPToggle = document.getElementById('toggleButton')
// VPToggle.addEventListener('click', function() {
// if (VP.paused) VP.play()
// else VP.pause()
// })
}
================================================
FILE: server.js
================================================
const express = require('express')
const fs = require('fs')
const path = require('path')
const app = express()
app.use(express.static(path.join(__dirname, 'public')))
app.get('/', function(req, res) {
res.sendFile(path.join(__dirname + '/index.htm'))
})
app.get('/video', function(req, res) {
const path = 'assets/sample.mp4'
const stat = fs.statSync(path)
const fileSize = stat.size
const range = req.headers.range
if (range) {
const parts = range.replace(/bytes=/, "").split("-")
const start = parseInt(parts[0], 10)
const end = parts[1]
? parseInt(parts[1], 10)
: fileSize-1
if(start >= fileSize) {
res.status(416).send('Requested range not satisfiable\n'+start+' >= '+fileSize);
return
}
const chunksize = (end-start)+1
const file = fs.createReadStream(path, {start, end})
const head = {
'Content-Range': `bytes ${start}-${end}/${fileSize}`,
'Accept-Ranges': 'bytes',
'Content-Length': chunksize,
'Content-Type': 'video/mp4',
}
res.writeHead(206, head)
file.pipe(res)
} else {
const head = {
'Content-Length': fileSize,
'Content-Type': 'video/mp4',
}
res.writeHead(200, head)
fs.createReadStream(path).pipe(res)
}
})
app.listen(3000, function () {
console.log('Listening on port 3000!')
})
gitextract_xbp5mana/ ├── .gitignore ├── LICENSE ├── README.md ├── index.htm ├── package.json ├── public/ │ └── index.js └── server.js
SYMBOL INDEX (1 symbols across 1 files)
FILE: public/index.js
function init (line 7) | function init() {
Condensed preview — 7 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (4K chars).
[
{
"path": ".gitignore",
"chars": 31,
"preview": ".DS_STORE\n.vsCode/\nnode_modules"
},
{
"path": "LICENSE",
"chars": 1068,
"preview": "MIT License\n\nCopyright (c) 2017 Diogo Santos\n\nPermission is hereby granted, free of charge, to any person obtaining a co"
},
{
"path": "README.md",
"chars": 160,
"preview": "This is a basic sample of how to do video streaming using Node.js and HTML5\n\n# Install\n\n- git clone\n- npm install\n- npm "
},
{
"path": "index.htm",
"chars": 211,
"preview": "<html>\n <head>\n <title>Video stream sample</title>\n </head>\n <body>\n <video id=\"videoPlayer\" controls muted=\"mu"
},
{
"path": "package.json",
"chars": 341,
"preview": "{\n \"name\": \"video-stream-sample\",\n \"version\": \"1.0.0\",\n \"description\": \"Streaming video example\",\n \"main\": \"server.j"
},
{
"path": "public/index.js",
"chars": 443,
"preview": "document.addEventListener('DOMContentLoaded', init, false);\n\n/** \n* You can manipulate the video here\n* For example: Unc"
},
{
"path": "server.js",
"chars": 1344,
"preview": "const express = require('express')\nconst fs = require('fs')\nconst path = require('path')\nconst app = express()\n\napp.use("
}
]
About this extraction
This page contains the full source code of the daspinola/video-stream-sample GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 7 files (3.5 KB), approximately 1.1k tokens, and a symbol index with 1 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.