partial clone of Node's fs module (including streams) for the browser File System API

Nota Bene

A partial clone of Node.j's fs module (including streams) for the browser File System API. Currently, only asynchronous methods are provided, per the File System API (sync is in the spec but not supported yet). All methods copy Node's FS module. Use with browserify.

Nota Bene uses through to expose read and write streams.

  • createWriteStream
  • createReadStream
  • writeFile
  • write
  • unlink
  • rename (aka mv)
  • read
  • readdir
  • mkdir
  • rmdir
  • stat

There is also a helper method for the File System API.

  • setStorage(size)

Call this method before any others if you don't want these defaults:

size = 1024 * 1024 * 1024 // in bytes 

The default and standard for this module is persistent storage, to whatever extent the browser grants this.

npm install nota-bene

Then use it as you would the FS module, from the example in /test.js

var fs = require('./nota-bene');
var buf = new Float32Array(1024 * 1024);
for(var x = 0; x < buf.length; x++){
    buf[x] = Math.sin((x / 1024 * 1024) * Math.PI * 2)
fs.mkdir('/tmp', function(err){
    if(err) console.log(err)
        fs.writeFile('/tmp/pipeTest', buf, function(err){
            if(err) console.log(err)
            var ws = fs.createWriteStream('/tmp/pip')
            var rs = fs.createReadStream('/tmp/pipeTest')
            ws.on('data', function(data){
                fs.readFile('/tmp/pip', 'arraybuffer', function(errfile){
                    console.log('pipetest', err, file)
            }, 1000)

Currently the "test" is an incomplete example with some logging to the console. Real test forthcoming. It can be run like so:

First install browserify and opa

npm install -g browserify opa


git clone
cd nbfs
opa -n -e test.js

you can pass a port number:

opa -n -e test.js -p 5000