-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
more logging, fixed data encoding (video, images)
- Loading branch information
Robin Gottfried
committed
Feb 19, 2020
1 parent
89b7fbc
commit b84d622
Showing
3 changed files
with
36 additions
and
8 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
//-- vim: ft=javascript tabstop=2 softtabstop=2 expandtab shiftwidth=2 | ||
'use strict'; | ||
|
||
const crypto = require('crypto'); | ||
|
||
function checksum(data, {length=5}={}) { | ||
try { | ||
return crypto.createHash('md5').update(data).digest('hex').slice(0,length).replace(/(.{4})/g, ':$1').slice(1); | ||
} catch(err) { | ||
console.error(err, data); | ||
throw err; | ||
} | ||
} | ||
|
||
exports.checksum = checksum; | ||
module.exports.WsJsonProtocol = require('./ws-json').WsJsonProtocol; |
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