see https://github.com/webrtc/samples/blob/gh-pages/src/content/datachannel/datatransfer/js/main.js#L101 oddly, the filetransfer sample does not have this... might need to stop reading the file at that point.