Socket
Socket
Sign inDemoInstall

@jiaminghi/fs

Package Overview
Dependencies
0
Maintainers
2
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @jiaminghi/fs

Promise fs based on node.js fs


Version published
Weekly downloads
17
decreased by-43.33%
Maintainers
2
Install size
38.0 kB
Created
Weekly downloads
 

Readme

Source

ENGLISH

FS

LICENSE LICENSE

使用 Promise 封装了一些常用的文件系统方法(基于 Node.js 的 fs 文件系统)

npm 安装

$ npm install @jiaminghi/fs

使用

import { readFile } from '@jiaminghi/fs'

// do something

示例

stat
type stat = (
  path: fs.PathLike,
  options: fs.StatOptions = { bigint: false }
) => Promise<fs.Stats | fs.BigIntStats | false>
mkDir
type mkDir = (path: fs.PathLike, options: fs.MakeDirectoryOptions = {}) => Promise<boolean>
access
type access = (path: fs.PathLike, mode = fs.constants.F_OK) => Promise<boolean>
copyDir
type copyDir = (path: fs.PathLike, dest: string) => Promise<boolean>
readDir
type readDir = (path: fs.PathLike) => Promise<string[] | false>
clearDir
type clearDir = (path: fs.PathLike) => Promise<boolean>
emptyDir
type emptyDir = (path: fs.PathLike) => Promise<boolean>
readFile
type readFile = (
  path: fs.PathLike,
  options: { encoding: string; flag?: string } = { encoding: 'utf8' }
) => Promise<string | false>
writeFile
type writeFile = (
  path: fs.PathLike,
  data: any,
  option: fs.WriteFileOptions = 'utf8'
) => Promise<boolean>
dirForEach
type dirForEach = (path: fs.PathLike, callback: (path: string) => any) => Promise<boolean>
fileForEach
type fileForEach = (path: fs.PathLike, callback: (path: string) => any) => Promise<boolean>
unlinkDirFileByExtname
type unlinkDirFileByExtname = (path: fs.PathLike, extnames: string[] = []) => Promise<boolean>

Keywords

FAQs

Last updated on 06 Jul 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc