Skip to content

Commit

Permalink
reme
Browse files Browse the repository at this point in the history
  • Loading branch information
streamich committed Aug 13, 2017
1 parent e8d40b2 commit 448291f
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 90 deletions.
186 changes: 97 additions & 89 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ In-memory file-system with [Node's `fs` API](https://nodejs.org/api/fs.html).
- Implements *soft links* (aka symlinks, symbolic links)
- More testing coming soon*
- Permissions may* be implemented in the future
- Can be used in browser, see `memfs-webpack`

Usage:

Expand Down Expand Up @@ -67,6 +68,9 @@ import {Volume} from 'memfs';

const vol = Volume.fromJSON({'/foo': 'bar'});
vol.readFileSync('/foo'); // bar

const vol2 = Volume.fromJSON({'/foo': 'bar 2'});
vol2.readFileSync('/foo'); // bar 2
```

Use `memfs` together with [`unionfs`][unionfs] to create one filesystem
Expand Down Expand Up @@ -112,12 +116,12 @@ filesystem operations but are slightly different.
import {vol, fs} from 'memfs';
```

`vol` is an instance of `Volume` constructor, it is a default volume created
for your convenience. `fs` in an *fs-like* object created from `vol` using
`vol` is an instance of `Volume` constructor, it is the default volume created
for your convenience. `fs` is an *fs-like* object created from `vol` using
`createFsFromVolume(vol)`, see reference below.

All contents of the `fs` object are also exported individually, so you can use
`memfs` just like you would `fs` module:
`memfs` just like you would use the `fs` module:

```js
import {readFileSync, F_OK, ReadStream} from 'memfs';
Expand Down Expand Up @@ -183,19 +187,19 @@ Exports the whole contents of the volume recursively to a flat JSON object.
If this argument is omitted, the whole volume is exported. `paths` can be
an array of paths. A path can be a string, `Buffer` or an `URL` object.

`json` is an optional object parameter where the list of files will be added.
`json` is an optional object parameter which will be populated with the exported files.

`isRelative` is boolean that specifies if returned paths should be relative.

###### `vol.mkdirp(path, callback)`

Creates a directory tree recursively. `path` is specifies a directory to
Creates a directory tree recursively. `path` specifies a directory to
create and can be a string, `Buffer`, or an `URL` object. `callback` is
called on completion and may receive only one argument - an `Error` object.

###### `vol.mkdirpSync(path)`

A synchronous version of `vol.mkdirp`. This method throws.
A synchronous version of `vol.mkdirp()`. This method throws.

#### `createFsFromVolume(vol)`

Expand All @@ -222,89 +226,93 @@ you get from `require('fs')`. Here are some things this function does:

# API Status

- [x] Constants
- [x] `FSWatcher`
- [x] `ReadStream`
- [x] `WriteStream`
- [x] `Stats`
- [x] `access(path[, mode], callback)`
- Does not check permissions
- [x] `accessSync(path[, mode])`
- Does not check permissions
- [x] `appendFile(file, data[, options], callback)`
- [x] `appendFileSync(file, data[, options])`
- [x] `chmod(path, mode, callback)`
- [x] `chmodSync(path, mode)`
- [x] `chown(path, uid, gid, callback)`
- [x] `chownSync(path, uid, gid)`
- [x] `close(fd, callback)`
- [x] `closeSync(fd)`
- [x] `createReadStream(path[, options])`
- [x] `createWriteStream(path[, options])`
- [x] `exists(path, callback)`
- [x] `existsSync(path)`
- [x] `fchmod(fd, mode, callback)`
- [x] `fchmodSync(fd, mode)`
- [x] `fchown(fd, uid, gid, callback)`
- [x] `fchownSync(fd, uid, gid)`
- [x] `fdatasync(fd, callback)`
- [x] `fdatasyncSync(fd)`
- [x] `fstat(fd, callback)`
- [x] `fstatSync(fd)`
- [x] `fsync(fd, callback)`
- [x] `fsyncSync(fd)`
- [x] `ftruncate(fd[, len], callback)`
- [x] `ftruncateSync(fd[, len])`
- [x] `futimes(fd, atime, mtime, callback)`
- [x] `futimesSync(fd, atime, mtime)`
- [x] `lchmod(path, mode, callback)`
- [x] `lchmodSync(path, mode)`
- [x] `lchown(path, uid, gid, callback)`
- [x] `lchownSync(path, uid, gid)`
- [x] `link(existingPath, newPath, callback)`
- [x] `linkSync(existingPath, newPath)`
- [x] `lstat(path, callback)`
- [x] `lstatSync(path)`
- [x] `mkdir(path[, mode], callback)`
- [x] `mkdirSync(path[, mode])`
- [x] `mkdtemp(prefix[, options], callback)`
- [x] `mkdtempSync(prefix[, options])`
- [x] `open(path, flags[, mode], callback)`
- [x] `openSync(path, flags[, mode])`
- [x] `read(fd, buffer, offset, length, position, callback)`
- [x] `readSync(fd, buffer, offset, length, position)`
- [x] `readdir(path[, options], callback)`
- [x] `readdirSync(path[, options])`
- [x] `readFile(path[, options], callback)`
- [x] `readFileSync(path[, options])`
- [x] `readlink(path[, options], callback)`
- [x] `readlinkSync(path[, options])`
- [x] `realpath(path[, options], callback)`
- [x] `realpathSync(path[, options])`
- Caching not implemented
- [x] `rename(oldPath, newPath, callback)`
- [x] `renameSync(oldPath, newPath)`
- [x] `rmdir(path, callback)`
- [x] `rmdirSync(path)`
- [x] `stat(path, callback)`
- [x] `statSync(path)`
- [x] `symlink(target, path[, type], callback)`
- [x] `symlinkSync(target, path[, type])`
- [x] `truncate(path[, len], callback)`
- [x] `truncateSync(path[, len])`
- [x] `unlink(path, callback)`
- [x] `unlinkSync(path)`
- [x] `utimes(path, atime, mtime, callback)`
- [x] `utimesSync(path, atime, mtime)`
- [x] `watch(filename[, options][, listener])`
- [x] `watchFile(filename[, options], listener)`
- [x] `unwatchFile(filename[, listener])`
- [x] `write(fd, buffer[, offset[, length[, position]]], callback)`
- [x] `write(fd, string[, position[, encoding]], callback)`
- [x] `writeFile(file, data[, options], callback)`
- [x] `writeFileSync(file, data[, options])`
- [x] `writeSync(fd, buffer[, offset[, length[, position]]])`
- [x] `writeSync(fd, string[, position[, encoding]])`
All of the [Node's `fs` API](https://nodejs.org/api/fs.html) is implemented.
Some error messages may be inaccurate. File permissions are currently not
implemented (you have access to any file), basically `fs.access()` is a no-op.

- [x] Constants
- [x] `FSWatcher`
- [x] `ReadStream`
- [x] `WriteStream`
- [x] `Stats`
- [x] `access(path[, mode], callback)`
- Does not check permissions
- [x] `accessSync(path[, mode])`
- Does not check permissions
- [x] `appendFile(file, data[, options], callback)`
- [x] `appendFileSync(file, data[, options])`
- [x] `chmod(path, mode, callback)`
- [x] `chmodSync(path, mode)`
- [x] `chown(path, uid, gid, callback)`
- [x] `chownSync(path, uid, gid)`
- [x] `close(fd, callback)`
- [x] `closeSync(fd)`
- [x] `createReadStream(path[, options])`
- [x] `createWriteStream(path[, options])`
- [x] `exists(path, callback)`
- [x] `existsSync(path)`
- [x] `fchmod(fd, mode, callback)`
- [x] `fchmodSync(fd, mode)`
- [x] `fchown(fd, uid, gid, callback)`
- [x] `fchownSync(fd, uid, gid)`
- [x] `fdatasync(fd, callback)`
- [x] `fdatasyncSync(fd)`
- [x] `fstat(fd, callback)`
- [x] `fstatSync(fd)`
- [x] `fsync(fd, callback)`
- [x] `fsyncSync(fd)`
- [x] `ftruncate(fd[, len], callback)`
- [x] `ftruncateSync(fd[, len])`
- [x] `futimes(fd, atime, mtime, callback)`
- [x] `futimesSync(fd, atime, mtime)`
- [x] `lchmod(path, mode, callback)`
- [x] `lchmodSync(path, mode)`
- [x] `lchown(path, uid, gid, callback)`
- [x] `lchownSync(path, uid, gid)`
- [x] `link(existingPath, newPath, callback)`
- [x] `linkSync(existingPath, newPath)`
- [x] `lstat(path, callback)`
- [x] `lstatSync(path)`
- [x] `mkdir(path[, mode], callback)`
- [x] `mkdirSync(path[, mode])`
- [x] `mkdtemp(prefix[, options], callback)`
- [x] `mkdtempSync(prefix[, options])`
- [x] `open(path, flags[, mode], callback)`
- [x] `openSync(path, flags[, mode])`
- [x] `read(fd, buffer, offset, length, position, callback)`
- [x] `readSync(fd, buffer, offset, length, position)`
- [x] `readdir(path[, options], callback)`
- [x] `readdirSync(path[, options])`
- [x] `readFile(path[, options], callback)`
- [x] `readFileSync(path[, options])`
- [x] `readlink(path[, options], callback)`
- [x] `readlinkSync(path[, options])`
- [x] `realpath(path[, options], callback)`
- [x] `realpathSync(path[, options])`
- Caching not implemented
- [x] `rename(oldPath, newPath, callback)`
- [x] `renameSync(oldPath, newPath)`
- [x] `rmdir(path, callback)`
- [x] `rmdirSync(path)`
- [x] `stat(path, callback)`
- [x] `statSync(path)`
- [x] `symlink(target, path[, type], callback)`
- [x] `symlinkSync(target, path[, type])`
- [x] `truncate(path[, len], callback)`
- [x] `truncateSync(path[, len])`
- [x] `unlink(path, callback)`
- [x] `unlinkSync(path)`
- [x] `utimes(path, atime, mtime, callback)`
- [x] `utimesSync(path, atime, mtime)`
- [x] `watch(filename[, options][, listener])`
- [x] `watchFile(filename[, options], listener)`
- [x] `unwatchFile(filename[, listener])`
- [x] `write(fd, buffer[, offset[, length[, position]]], callback)`
- [x] `write(fd, string[, position[, encoding]], callback)`
- [x] `writeFile(file, data[, options], callback)`
- [x] `writeFileSync(file, data[, options])`
- [x] `writeSync(fd, buffer[, offset[, length[, position]]])`
- [x] `writeSync(fd, string[, position[, encoding]])`


[npm-url]: https://www.npmjs.com/package/memfs
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "memfs",
"version": "2.0.2",
"version": "2.0.3",
"description": "In-memory file-system with Node's fs API.",
"main": "lib/index.js",
"keywords": [
Expand Down

0 comments on commit 448291f

Please sign in to comment.