• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2require('../common');
3const assert = require('assert');
4const fs = require('fs');
5const stream = require('stream');
6const fixtures = require('../common/fixtures');
7const encoding = 'base64';
8
9const example = fixtures.path('x.txt');
10const assertStream = new stream.Writable({
11  write: function(chunk, enc, next) {
12    const expected = Buffer.from('xyz');
13    assert(chunk.equals(expected));
14  }
15});
16assertStream.setDefaultEncoding(encoding);
17fs.createReadStream(example, encoding).pipe(assertStream);
18