Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/metarhia/sandboxed-fs

Sandbox wrapper for Node.js File System API 💾
https://github.com/metarhia/sandboxed-fs

api application-sandbox application-security application-server filesystem fs impress javascript js lock metarhia node nodejs sandbox sandboxed sandboxing security wrapper

Last synced: 2 days ago
JSON representation

Sandbox wrapper for Node.js File System API 💾

Awesome Lists containing this project

README

        


sandboxed-fs












`sandboxed-fs` is a sandboxed wrapper for Node.js file system module implementing
the same API but bound to a certain directory, reliably locked in it.

## Usage

- Install: `npm install sandboxed-fs`
- Require: `const fs = require('sandboxed-fs').bind(path);`

## Examples:

```javascript
const fs = require('sandboxed-fs').bind(path);

fs.readFile('file.ext', (err, data) => {
if (err) return console.log('Cannot read file');
});

fs.readFile('../../file.ext', (err, data) => {
if (err) return console.log('Cannot read file');
});
```