2016-06-10 09:27:15 +02:00
|
|
|
'use strict';
|
2017-03-24 09:46:44 -07:00
|
|
|
|
2017-05-03 21:07:54 -07:00
|
|
|
require('../common');
|
2016-06-10 09:27:15 +02:00
|
|
|
const stream = require('stream');
|
|
|
|
const assert = require('assert');
|
|
|
|
|
|
|
|
const readable = new stream.Readable({
|
2017-05-03 21:07:54 -07:00
|
|
|
read: () => {},
|
2016-06-10 09:27:15 +02:00
|
|
|
encoding: 'utf16le',
|
|
|
|
objectMode: true
|
|
|
|
});
|
|
|
|
|
|
|
|
readable.push(Buffer.from('abc', 'utf16le'));
|
|
|
|
readable.push(Buffer.from('def', 'utf16le'));
|
|
|
|
readable.push(null);
|
|
|
|
|
|
|
|
// Without object mode, these would be concatenated into a single chunk.
|
|
|
|
assert.strictEqual(readable.read(), 'abc');
|
|
|
|
assert.strictEqual(readable.read(), 'def');
|
|
|
|
assert.strictEqual(readable.read(), null);
|