level-filesystem

WebJar for level-filesystem

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

level-filesystem
Last Version

Last Version

1.2.0
Release Date

Release Date

Type

Type

jar
Description

Description

level-filesystem
WebJar for level-filesystem
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/mafintosh/level-filesystem

Download level-filesystem

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/level-filesystem/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>level-filesystem</artifactId>
    <version>1.2.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/level-filesystem/
implementation 'org.webjars.npm:level-filesystem:1.2.0'
// https://jarcasting.com/artifacts/org.webjars.npm/level-filesystem/
implementation ("org.webjars.npm:level-filesystem:1.2.0")
'org.webjars.npm:level-filesystem:jar:1.2.0'
<dependency org="org.webjars.npm" name="level-filesystem" rev="1.2.0">
  <artifact name="level-filesystem" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='level-filesystem', version='1.2.0')
)
libraryDependencies += "org.webjars.npm" % "level-filesystem" % "1.2.0"
[org.webjars.npm/level-filesystem "1.2.0"]

Dependencies

compile (9)

Group / Artifact Type Version
org.webjars.npm : once jar [1.3.0,2)
org.webjars.npm : concat-stream jar [1.4.4,2)
org.webjars.npm : errno jar [0.1.1,0.2)
org.webjars.npm : xtend jar [2.2.0,3)
org.webjars.npm : octal jar [1.0.0,2)
org.webjars.npm : level-blobs jar [0.1.7,0.2)
org.webjars.npm » fwd-stream jar [1.0.4,2)
org.webjars.npm : level-peek jar [1.0.6,2)
org.webjars.npm : level-sublevel jar [5.2.0,6)

Project Modules

There are no modules declared in this project.

level-filesystem

Full implementation of the fs module on top of leveldb (except sync ops)

npm install level-filesystem

build status dat

browser support

Current status

All async methods in the fs module are supported and well tested (including links!)

✓ fs.rmdir(path, callback)
✓ fs.mkdir(path, [mode], callback)
✓ fs.readdir(path, callback)
✓ fs.stat(path, callback)
✓ fs.exists(path, callback)
✓ fs.chmod(path, mode, callback)
✓ fs.chown(path, uid, gid, callback)
✓ fs.rename(oldPath, newPath, callback)
✓ fs.realpath(path, [cache], callback)
✓ fs.readFile(filename, [options], callback)
✓ fs.writeFile(filename, data, [options], callback)
✓ fs.appendFile(filename, data, [options], callback)
✓ fs.utimes(path, atime, mtime, callback)
✓ fs.unlink(path, callback)
✓ fs.createReadStream(path, [options])
✓ fs.createWriteStream(path, [options])
✓ fs.truncate(path, len, callback)
✓ fs.watchFile(filename, [options], listener)
✓ fs.unwatchFile(filename, [listener])
✓ fs.watch(filename, [options], [listener])
✓ fs.fsync(fd, callback)
✓ fs.write(fd, buffer, offset, length, position, callback)
✓ fs.read(fd, buffer, offset, length, position, callback)
✓ fs.close(fd, callback)
✓ fs.open(path, flags, [mode], callback)
✓ fs.futimes(fd, atime, mtime, callback)
✓ fs.fchown(fd, uid, gid, callback)
✓ fs.ftruncate(fd, len, callback)
✓ fs.fchmod(fd, mode, callback)
✓ fs.fstat(fd, callback)
✓ fs.lchown(path, uid, gid, callback)
✓ fs.lchmod(path, mode, callback)
✓ fs.symlink(srcpath, dstpath, [type], callback)
✓ fs.lstat(path, callback)
✓ fs.readlink(path, callback)
✓ fs.link(srcpath, dstpath, callback)

If any of the methods do not behave as you would expect please add a test case or open an issue.

Usage

var filesystem = require('level-filesystem');
var fs = filesystem(db); // where db is a levelup instance

// use fs as you would node cores fs module

fs.mkdir('/hello', function(err) {
	if (err) throw err;
	fs.writeFile('/hello/world.txt', 'world', function(err) {
		if (err) throw err;
		fs.readFile('/hello/world.txt', 'utf-8', function(err, data) {
			console.log(data);
		});
	});
});

Errors

When you get an error in a callback it is similar to what you get in Node core fs.

fs.mkdir('/hello', function() {
	fs.mkdir('/hello', function(err) {
		console.log(err); // err.code is EEXIST
	});
});

fs.mkdir('/hello', function() {
	fs.readFile('/hello', function(err) {
		console.log(err); // err.code is EISDIR
	});
});

...

Relation to level-fs

The goal of this module is similar to level-fs and is probably gonna end up as a PR to that module. I decided to make this as a standalone module (for now) since adding proper directory support to level-fs turned out to be non-trivial (more or a less a complete rewrite).

License

MIT

Versions

Version
1.2.0