Classes
Members
- FSIndex
FSIndex is a Mongoose Model representing a directory tree
- FSHandle
FSHandle is a Mongoose Model representing a File
Functions
- createServer()
Return an express app serving the filesystem's RESTful API
GFS
Kind: global class
new GFS()
This is a "userland" object, meant to be explicitly require
d and used by a user.
The API provided by this object mirrors the native 'fs' API
so that it is trivial for a user to switch to using GFS instead.
e.g.
var fs = require('fs'); // this line is replaced by the line below
var fs = require('things-js').gfs(globalScope); // globalScope needs to be passed in to link the Pubsub instance
gfS.readFile(path, arg1, arg2)
Read from a file asynchronously; it has the same interface as fs.readFile
Kind: instance method of GFS
Param | Type | Description | |
---|---|---|---|
path | string |
absolute path to the file (currently relative paths cannot be resolved) | |
arg1 | function \ |
Object |
if given a function, it is used as the callback. if given an object, it is used as the options object |
arg2 | function |
if arg1 is an object, this is used as the callback. |
gfS.writeFile(path, data, arg1, arg2)
Write to a file asynchronously; it has the same interface as fs.writeFile
Kind: instance method of GFS
Param | Type | Description | |
---|---|---|---|
path | string |
absolute path to the file | |
data | string |
text to write (currently only supports string) | |
arg1 | function \ |
Object |
if given a function, it is used as the callback. if given an object, it is used as the options object |
arg2 | function |
if arg1 is an object, this is used as the callback. |
gfS.appendFile(path, data, arg1, arg2)
Append to a file asynchronously; it has the same interface as fs.appendFile
Kind: instance method of GFS
Param | Type | Description | |
---|---|---|---|
path | string |
absolute path to the file | |
data | string |
text to write (currently only supports string) | |
arg1 | function \ |
Object |
if given a function, it is used as the callback. if given an object, it is used as the options object |
arg2 | function |
if arg1 is an object, this is used as the callback. |
GFS.bootstrap()
This is the function that is exported as the gfs module, used to bootstrap the file system.
After a user require
s this module, it can be used thus:
var fs = require('things-js').gfs('mongodb://localhost/my-database');
Kind: static method of GFS
FSIndex
FSIndex is a Mongoose Model representing a directory tree
FSHandle
FSHandle is a Mongoose Model representing a File
createServer()
Return an express app serving the filesystem's RESTful API
Kind: global function