alanszlosek/nodeftpd — pull request #5 by Tuskan360 (2012-04-19 02:37:58+00:00)
Title: Allow user to provide a virtual file system

This would allow any module implimenting:

fs.unlink(path, callback(err))

fs.readdir(path, callback(err, files)

fs.statSync(path)
fs.stat(path, callback(err, s))

fs.mkdir(path, mode = 0755, callback(err))

fs.open(path, flags = 'r', callback(err, fd))
fs.read(fd, 4096, socket.totsize, socket.mode, callback(err, chunk, bytes_read))
fs.close(fd, callback)

fs.open(path, flags = 'w', 0644, callback(err, fd)
fs.write(fd, buf, 0, buf.length, null, writeCallback)

fs.rmdir(path, callback(err))

fs.rename(path, path, callback(err))

to be passed in, regardless of the actual store used on the back end (e.g. AmazonS3, Azure, etc.)

todo: convert to use stat rather than statSync as many virtual file systems may not support syncronous stat operation.
todo: provide user object to store so store can fail based on authorization?
todo: build sample virtual file system implimentation for at least one db type