1.0.4 • Published 4 years ago

reserve-fs v1.0.4

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

REserve/fs

File system mapper for REserve. It makes Node.js' fs APIs available in the browser.

Travis-CI Coverage Status Maintainability Package Quality Known Vulnerabilities dependencies Status devDependencies Status reserve reserve install size MIT License

Usage

  • In the mapping :
{
  "handlers": {
    "fs": "reserve-fs"
  },
  "mappings": [{
    "match": "\\/fs",
    "fs": "./"
  }]
}
  • In the HTML page :
<script src='/fs'></script>
  • In JavaScript :
fs.readdirAsync('folder')
  .then(names => names.forEach(async name => {
    const stat = await fs.statAsync('folder/' + name)
    console.log(name, stat.size, stat.ctime, stat.mtime)
  }))

Options

OptionDefault ValueExplanation
client-name'fs'Name of the member added to the browser window
read-onlyfalseForbids write methods if true

All APIs are restricted to the scope of the path configured in the mapping. Any attempt to read or write elsewhere will lead to a 403 error.

Supported APIs

The following APIs are supported. A promisified version of each method is provided under the same name suffixed with Async (for instance: fs.readdirAsync).

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.0

4 years ago