From cce22ea599a9eb4a7ea4e35a47c2e989a55ece72 Mon Sep 17 00:00:00 2001 From: "David Humphrey (:humph) david.humphrey@senecacollege.ca" Date: Fri, 29 Nov 2013 11:37:58 -0500 Subject: [PATCH] Fix indent level on API headers in README --- README.md | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index c631fb7..689a668 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ fs = new IDBFS.FileSystem({ }, fsReady); ``` -###IDBFS.FileSystem.providers - Storage Providers +####IDBFS.FileSystem.providers - Storage Providers IDBFS can be configured to use a number of different storage providers. The provider object encapsulates all aspects of data access, making it possible to swap in different backend storage options. There are currently 4 different @@ -131,6 +131,39 @@ if( IDBFS.FileSystem.providers.WebSQL.isSupported() ) { You can also write your own provider if you need a different backend. See the code in `src/providers` for details. +####IDBFS.Path + +The node.js [path module](http://nodejs.org/api/path.html) is available via the `IDBFS.Path` object. It is +identical to the node.js version with the following differences: +* No support for `exits()` or `existsSync()`. Use `fs.stat()` instead. +* No notion of a current working directory in `resolve` (the root dir is used instead) + +```javascript +var path = IDBFS.Path; +var dir = path.dirname('/foo/bar/baz/asdf/quux'); +// dir is now '/foo/bar/baz/asdf' + +var base = path.basename('/foo/bar/baz/asdf/quux.html'); +// base is now 'quux.html' + +var ext = path.extname('index.html'); +// ext is now '.html' + +var newpath = path.join('/foo', 'bar', 'baz/asdf', 'quux', '..'); +// new path is now '/foo/bar/baz/asdf' +``` + +For more info see the docs in the [path module](http://nodejs.org/api/path.html) for a particular method: +* `path.normalize(p)` +* `path.join([path1], [path2], [...])` +* `path.resolve([from ...], to)` +* `path.relative(from, to)` +* `path.dirname(p)` +* `path.basename(p, [ext])` +* `path.extname(p)` +* `path.sep` +* `path.delimiter` + #### fs.stat(path, callback) Asynchronous stat(2). Callback gets `(error, stats)`, where `stats` is an object like