Skip to content
This repository has been archived by the owner on Jul 17, 2019. It is now read-only.

ianwalter/fs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@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 async 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.name, action.args)
    })
  3. Control async filesystem events through subscriptions, e.g.:
    fs.sub('./top-secret.txt', async action => {
      if (action.name === '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