@ianwalter/fs

1.1.0 • Public • Published

@ianwalter/fs

A Proxy over Node's fs module to make it Promise-based and add events

npm page

Features

  1. Use Promises and/or async/await with fs methods, e.g.:
    const text = await fs.readFile('./top-secret.txt')
  2. Subscribe to filesystem events from anywhere, e.g.:
    fs.sub('./top-secret.txt', action => {
      console.log(action.method, action.args)
    })
  3. Control async filesystem events through subscriptions, e.g.:
    fs.sub('./top-secret.txt', async action => {
      if (action.method === 'writeFile') {
        throw new Error('How dare you!? You have no write!')
      }
    })

Installation

yarn add @ianwalter/fs

License

Apache 2.0 with Commons Clause - See LICENSE

 

Created by Ian Walter

Package Sidebar

Install

npm i @ianwalter/fs

Weekly Downloads

3

Version

1.1.0

License

SEE LICENSE IN LICENSE

Unpacked Size

6.01 kB

Total Files

7

Last publish

Collaborators

  • ianwalter