11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_cirequire('../common'); 31cb0ef41Sopenharmony_ciconst assert = require('assert'); 41cb0ef41Sopenharmony_ciconst fs = require('fs'); 51cb0ef41Sopenharmony_ciconst stream = require('stream'); 61cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures'); 71cb0ef41Sopenharmony_ciconst encoding = 'base64'; 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ciconst example = fixtures.path('x.txt'); 101cb0ef41Sopenharmony_ciconst assertStream = new stream.Writable({ 111cb0ef41Sopenharmony_ci write: function(chunk, enc, next) { 121cb0ef41Sopenharmony_ci const expected = Buffer.from('xyz'); 131cb0ef41Sopenharmony_ci assert(chunk.equals(expected)); 141cb0ef41Sopenharmony_ci } 151cb0ef41Sopenharmony_ci}); 161cb0ef41Sopenharmony_ciassertStream.setDefaultEncoding(encoding); 171cb0ef41Sopenharmony_cifs.createReadStream(example, encoding).pipe(assertStream); 18