# fs-promise-lite

> the version promise of fs

Latest version **1.0.0** (published 2017-10-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install fs-promise-lite
pnpm add fs-promise-lite
yarn add fs-promise-lite
bun add fs-promise-lite
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2017-10-04 |
| First published | 2017-10-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | leavesdrift |
| Maintainers | leavesdrift |
| Keywords | fs, promise |

## Links

- npm: https://www.npmjs.com/package/fs-promise-lite
- npm.io page: https://npm.io/package/fs-promise-lite

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.0.0 (latest) — 2017-10-04

## README

## Installation
```
npm install --save fs-promise-lite

npm install --save-dev fs-promise-lite
```

## Utilisation
the same api with original fs
```
const fs = require('fs-promise-lite')

fs.readFile('file1.txt','utf8')
  .then((data) => {
   console.log(data)
  })
```

## Supported
```
fs.readdir(dir,options)

fs.readFile(file,options)

fs.stat(file)

fs.writeFile(file,data,options)

fs.unlink(file)

fs.mkdir(dirname,mode)

fs.rmdir(dirname)

fs.appendFile(file,data,options)

fs.chmod(path,mode)

fs.chown(path,uid,gid)

fs.symlink(target,path,type)
```

## Exceptional
1. readFiles(fileArr,options) - read many files
```
const fs = require('fs-promise-lite')

let arr = ['file1.txt','file2.txt','file3.txt']

Promise.all(fs.readFiles(arr,'utf8'))
       .then(console.log)

// [['file1.txt','data1'],['file2.txt','data2'],['file3.txt','data3']]
```
2. unlinks(fileArr) - delete many files
```
const fs = require('fs-promise-lite')

let arr = ['file1.txt','file2.txt','file3.txt']

Promise.all(fs.unlinks(arr))
       .then(() => {
         console.log('ok')
       })

```
3. writeFiles(files_datas,options)

```
const fs = require('fs-promise-lite')

let files_datas = [
 ['file1.txt','data1'],
 ['file2.txt','data2'],
 ['file3.txt','data3']
]

Promise.all(fs.writeFiles(files_datas,'utf8'))
       .then(() => {
         console.log('ok')
       })
```

4. stats(files)
```
const fs = require('fs-promise-lite')

let arr = ['file1.txt','file2.txt','file3.txt']

Promise.all(fs.stats(arr))
       .then(console.log)

/*
[['file1.txt',Object_stat1],['file2.txt',Object_stat2],['file3.txt',Object_stat3]]
which Object_stats is like:

Stats {
  dev: 66311,
  mode: 33188,
  nlink: 1,
  uid: 0,
  gid: 0,
  rdev: 0,
  blksize: 4096,
  ino: 3288667,
  size: 202,
  blocks: 8,
  atimeMs: 1507047059530.785,
  mtimeMs: 1507047058318.7754,
  ctimeMs: 1507047058326.7754,
  birthtimeMs: 1507047058326.7754,
  atime: 2017-10-03T16:10:59.531Z,
  mtime: 2017-10-03T16:10:58.319Z,
  ctime: 2017-10-03T16:10:58.327Z,
  birthtime: 2017-10-03T16:10:58.327Z
  }
*/
```

---
_Source: https://npm.io/package/fs-promise-lite · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
