npm.io
3.2.5 • Published 1 year ago

@techor/fs

Licence
MIT
Version
3.2.5
Deps
0
Size
10 kB
Vulns
0
Weekly
0
Stars
11

A human-friendly file system

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


Getting Started

npm install @techor/fs

Usage

readFileSync(filepath: string, options?: Options): Buffer
readFileAsNormalizedStrSync(filepath: string, options?: Options): string
readJSONFileSync(filepath: string, options?: Options): any

writeToFile(filePath: string, data: any, options?: WriteToFileOptions): void

a.json

{ "name": "a" }

b.json

{ "name": "b" }
import { readFileSync } from '@techor/fs'

readFileSync('a.*')
// Buffer

readFileSync('./fewjiogw/wiefoiwe')
// undefined

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

readJSONFileSync('./package.json')
// { "name": "root", ... }

readJSONFileSync('./package.json')
// { "name": "a", ... }

Options

declare type Options = ObjectEncodingOptions & { encoding?: BufferEncoding | null }

NPM Version

Keywords