npm.io
1.5.5 • Published 3 years ago

to-read-file

Licence
MIT
Version
1.5.5
Deps
4
Size
7 kB
Vulns
0
Weekly
0

Read a file content by glob patterns

NPM Version NPM Version NPM package ( download / month ) Follow @mastercorg Github release actions


Getting Started

npm install to-read-file

Usage

readFile(source?: string | fg.Pattern[], options?: Options): Buffer
readFiles(source?: string | fg.Pattern[], options?: Options): Buffer

a.json

{ "name": "a" }

b.json

{ "name": "b" }
import readFile, { readFiles } from 'to-read-file'

readFile('a.*').toString()
// { "name": "a" }

readFiles('*.json').toString()
// { "name": "a" },{ "name": "b" }

Options

Inherited from fast-glob options

{
    cwd: process.cwd()
}

With additional options:

{
    encoding?: null
    flag?: string
}

NPM Version