| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 953a850 commit 1c6fbd6
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,21 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + | ||
| 3 | + const common = require('../common'); | ||
| 4 | + | ||
| 5 | + if (!common.hasCrypto) | ||
| 6 | + common.skip('missing crypto'); | ||
| 7 | + | ||
| 8 | + const assert = require('assert'); | ||
| 9 | + const crypto = require('crypto'); | ||
| 10 | + const stream = require('stream'); | ||
| 11 | + | ||
| 12 | + const hash = crypto.createHash('md5'); | ||
| 13 | + const s = new stream.PassThrough(); | ||
| 14 | + const expect = 'e8dc4081b13434b45189a720b77b6818'; | ||
| 15 | + | ||
| 16 | + s.write('abcdefgh'); | ||
| 17 | + stream.pipeline(s, hash, common.mustCall(function(err) { | ||
| 18 | + assert.ifError(err); | ||
| 19 | + assert.strictEqual(hash.digest('hex'), expect); | ||
| 20 | + })); | ||
| 21 | + s.end(); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments