MCPcopy Index your code
hub / github.com/nodejs/node / getOptions

Function getOptions

lib/internal/fs/utils.js:326–347  ·  view source on GitHub ↗
(options, defaultOptions = kEmptyObject)

Source from the content-addressed store, hash-verified

324}
325
326function getOptions(options, defaultOptions = kEmptyObject) {
327 if (options == null || typeof options === 'function') {
328 return defaultOptions;
329 }
330
331 if (typeof options === 'string') {
332 defaultOptions = { ...defaultOptions };
333 defaultOptions.encoding = options;
334 options = defaultOptions;
335 } else if (typeof options !== 'object') {
336 throw new ERR_INVALID_ARG_TYPE('options', ['string', 'Object'], options);
337 }
338
339 if (options.encoding !== 'buffer')
340 assertEncoding(options.encoding);
341
342 if (options.signal !== undefined) {
343 validateAbortSignal(options.signal, 'options.signal');
344 }
345
346 return options;
347}
348
349/**
350 * @param {InternalFSBinding.FSSyncContext} ctx

Callers 15

ReadStreamFunction · 0.70
WriteStreamFunction · 0.70
readdirFunction · 0.70
readlinkFunction · 0.70
realpathFunction · 0.70
mkdtempFunction · 0.70
mkdtempDisposableFunction · 0.70
writeFileFunction · 0.70
appendFileFunction · 0.70
readFileFunction · 0.70
constructorMethod · 0.70
opendirFunction · 0.70

Calls 2

assertEncodingFunction · 0.85
validateAbortSignalFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…