• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2require('../common');
3const Readable = require('_stream_readable');
4const assert = require('assert');
5
6let buf = '';
7const euro = Buffer.from([0xE2, 0x82, 0xAC]);
8const cent = Buffer.from([0xC2, 0xA2]);
9const source = Buffer.concat([euro, cent]);
10
11const readable = Readable({ encoding: 'utf8' });
12readable.push(source.slice(0, 2));
13readable.push(source.slice(2, 4));
14readable.push(source.slice(4, 6));
15readable.push(null);
16
17readable.on('data', function(data) {
18  buf += data;
19});
20
21process.on('exit', function() {
22  assert.strictEqual(buf, '€¢');
23});
24