This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener('DOMContentLoaded', event => { | |
const peer = new Peer('sender', { host: 'localhost', port: 9000, path: '/' }) | |
const conn = peer.connect('receiver') | |
document.querySelector('input').onchange = function(event) { | |
const file = event.target.files[0] | |
const blob = new Blob(event.target.files, { type: file.type }) | |
conn.send({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener('DOMContentLoaded', event => { | |
const peer = new Peer('receiver', { | |
host: 'localhost', | |
port: 9000, | |
path: '/' | |
}) | |
peer.on('connection', conn => { | |
conn.on('data', data => { | |
if (data.filetype.includes('image')) { |
OlderNewer