%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
'use strict'; require('../common'); const fixtures = require('../common/fixtures'); const path = require('path'); const fs = require('fs'); const assert = require('assert'); const tmpdir = require('../common/tmpdir'); tmpdir.refresh(); const streamOpts = ['open', 'close']; const writeStreamOptions = [...streamOpts, 'write']; const readStreamOptions = [...streamOpts, 'read']; const originalFs = { fs }; { const file = path.join(tmpdir.path, 'write-end-test0.txt'); writeStreamOptions.forEach((fn) => { const overrideFs = Object.assign({}, originalFs.fs, { [fn]: null }); if (fn === 'write') overrideFs.writev = null; const opts = { fs: overrideFs }; assert.throws( () => fs.createWriteStream(file, opts), { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError', message: `The "options.fs.${fn}" property must be of type function. ` + 'Received null' }, `createWriteStream options.fs.${fn} should throw if isn't a function` ); }); } { const file = path.join(tmpdir.path, 'write-end-test0.txt'); const overrideFs = Object.assign({}, originalFs.fs, { writev: 'not a fn' }); const opts = { fs: overrideFs }; assert.throws( () => fs.createWriteStream(file, opts), { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError', message: 'The "options.fs.writev" property must be of type function. ' + 'Received type string (\'not a fn\')' }, 'createWriteStream options.fs.writev should throw if isn\'t a function' ); } { const file = fixtures.path('x.txt'); readStreamOptions.forEach((fn) => { const overrideFs = Object.assign({}, originalFs.fs, { [fn]: null }); const opts = { fs: overrideFs }; assert.throws( () => fs.createReadStream(file, opts), { code: 'ERR_INVALID_ARG_TYPE', name: 'TypeError', message: `The "options.fs.${fn}" property must be of type function. ` + 'Received null' }, `createReadStream options.fs.${fn} should throw if isn't a function` ); }); }