blob: 4c572fed6b665b65365af1d96fe92188cff87662 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
'use strict';
require('../common');
const stream = require('stream');
const assert = require('assert');
const readable = new stream.Readable({
read: () => {},
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);
|