Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@techor/fs

Package Overview
Dependencies
Maintainers
1
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@techor/fs

A human-friendly file system with glob patterns

  • 2.2.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
906
decreased by-12.12%
Maintainers
1
Weekly downloads
 
Created
Source

Read a file content by glob patterns

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


Getting Started

npm install @techor/fs

Usage

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

writeToFile(filePath: fs.PathOrFileDescriptor, data: any, options?: WriteToFileOptions): void

a.json

{ "name": "a" }

b.json

{ "name": "b" }
import { readFile, readFiles } from '@techor/fs'

readFile('a.*')
// Buffer

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

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

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

readFileAsJSON('./package.json', { cwd: path.resolve('./packages/a') })
// { "name": "a", ... }

readFiles('*.json').toString()
// [Buffer, Buffer]

Options

File reading methods inherit fast-glob options

{
    cwd: process.cwd()
}

With additional options:

{
    encoding?: null
    flag?: string
}

NPM Version

Keywords

FAQs

Package last updated on 06 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc