first commit

This commit is contained in:
developertrinidad08
2023-01-16 18:11:14 -03:00
commit 7e6cf29479
233 changed files with 26791 additions and 0 deletions

14
node_modules/binaryjs/examples/helloworld/README.md generated vendored Normal file
View File

@ -0,0 +1,14 @@
## Hello World example
1. Run the server:
```
node server.js
```
2. Open `index.html` in your browser
You should see a flower. If not, your browser probably doesn't support binary websockets.
Server code is contained in `server.js`
Client side code is contained in `index.html`

BIN
node_modules/binaryjs/examples/helloworld/flower.png generated vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB

26
node_modules/binaryjs/examples/helloworld/index.html generated vendored Normal file
View File

@ -0,0 +1,26 @@
<html>
<head>
<script src="http://cdn.binaryjs.com/0/binary.js"></script>
<script>
// Connect to Binary.js server
var client = new BinaryClient('ws://localhost:9000');
// Received new stream from server!
client.on('stream', function(stream, meta){
// Buffer for parts
var parts = [];
// Got new data
stream.on('data', function(data){
parts.push(data);
});
stream.on('end', function(){
// Display new data in browser!
var img = document.createElement("img");
img.src = (window.URL || window.webkitURL).createObjectURL(new Blob(parts));
document.body.appendChild(img);
});
});
</script>
</head>
<body>
</body>
</html>

12
node_modules/binaryjs/examples/helloworld/server.js generated vendored Normal file
View File

@ -0,0 +1,12 @@
var BinaryServer = require('../../').BinaryServer;
var fs = require('fs');
// Start Binary.js server
var server = BinaryServer({port: 9000});
// Wait for new user connections
server.on('connection', function(client){
// Stream a flower as a hello!
var file = fs.createReadStream(__dirname + '/flower.png');
client.send(file);
});