JSPM

assert-fs-readfile-option

2.0.0-0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1289
  • Score
    100M100P100Q123559F
  • License ISC

Test if value is valid for fs.readFile option

Package Exports

  • assert-fs-readfile-option

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (assert-fs-readfile-option) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

assert-fs-readfile-option

npm version Build Status Coverage Status

Test if a value is valid for fs.readFile options

const assertFsReadFileOption = require('assert-fs-readfile-option');

assertFsReadFileOption({encoding: 'utf8', flag: 'r'});
// doesn't throw

assertFsReadFileOption({flag: 'foo'});
// throws `TypeError [ERR_INVALID_OPT_VALUE]: The value "foo" is invalid for option "flags"`

assertFsReadFileOption('base64');
// doesn't throw

assertFsReadFileOption('base65');
// throws `TypeError [ERR_INVALID_OPT_VALUE_ENCODING]: The value "base65" is invalid for option "encoding"`

assertFsReadFileOption();
// doesn't throw

Installation

Use npm.

npm install assert-fs-readfile-option

API

const assertFsReadFileOption = require('assert-fs-readfile-option');

assertFsReadFileOption([maybeOption])

maybeOption: any types

It throws an error when the argument is not a valid value for fs.readFile options. See the test for more detailed specifications.

License

ISC License © 2017 Shinnosuke Watanabe