# mongofuse

> A FUSE filesystem, powered by MongoDB and written in Node.js. Mostly an exercise for me to learn MongoDB and Node.js. It aims towards POSIX functionality for use as a regular filesystem.

Latest version **0.10.1** (published 2018-08-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install mongofuse
pnpm add mongofuse
yarn add mongofuse
bun add mongofuse
```

Provides the command `mongofuse`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.10.1 |
| Published | 2018-08-01 |
| First published | 2016-05-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 43.7 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 8 |
| Author | David Knoll |
| Maintainers | davidknoll |
| Keywords | fuse, mongodb, filesystem, learning |

## Links

- npm: https://www.npmjs.com/package/mongofuse
- Repository: https://github.com/davidknoll/mongofuse
- Homepage: https://github.com/davidknoll/mongofuse#readme
- Issues: https://github.com/davidknoll/mongofuse/issues
- npm.io page: https://npm.io/package/mongofuse

## Dependencies (5)

- [async](https://npm.io/package/async.md) ^1.5.2
- [posix](https://npm.io/package/posix.md) ^4.1.2
- [yargs](https://npm.io/package/yargs.md) ^4.7.1
- [mongojs](https://npm.io/package/mongojs.md) ^2.6.0
- [fuse-bindings](https://npm.io/package/fuse-bindings.md) ^2.11.2

## Alternatives

- [angular-pipes](https://npm.io/package/angular-pipes.md) — 5.6K weekly downloads
- [@ng-web-apis/midi](https://npm.io/package/@ng-web-apis/midi.md) — 2.6K weekly downloads
- [happn-3](https://npm.io/package/happn-3.md) — 1.6K weekly downloads
- [@opensip-cli/lang-go](https://npm.io/package/@opensip-cli/lang-go.md) — 1.2K weekly downloads
- [mongoose-typescript](https://npm.io/package/mongoose-typescript.md) — 85 weekly downloads

## Recent versions

- 0.10.1 (latest) — 2018-08-01
- 0.10.0 — 2018-08-01
- 0.9.2 — 2016-10-02
- 0.9.1 — 2016-10-02
- 0.9.0 — 2016-09-30
- 0.8.0 — 2016-08-08
- 0.7.2 — 2016-05-30
- 0.7.1 — 2016-05-30
- 0.7.0 — 2016-05-30
- 0.6.2 — 2016-05-29
- 0.6.1 — 2016-05-29
- 0.6.0 — 2016-05-26
- 0.5.0 — 2016-05-26
- 0.4.0 — 2016-05-15
- 0.3.1 — 2016-05-15
- … 1 more at https://npm.io/package/mongofuse/versions

## README

# mongofuse
A FUSE filesystem, powered by MongoDB and written in Node.js.
Mostly an exercise for me to learn MongoDB and Node.js.
It aims towards POSIX functionality for use as a regular filesystem.

### Starting
If cloned from GitHub, you'll need to run `npm install` from the directory of
your clone, then any of:
* `npm start connection-string mountpoint [-o option[,option]...]`
* `node index.js connection-string mountpoint [-o option[,option]...]`
* `./index.js connection-string mountpoint [-o option[,option]...]`

You can also install globally with `npm install -g mongofuse`, in which case run:
* `mongofuse connection-string mountpoint [-o option[,option]...]`

where `connection-string` is a MongoDB [connection string](https://docs.mongodb.com/manual/reference/connection-string/)
(maybe just `mongofuse` to use a database called `mongofuse` on an instance
running on localhost on the standard port) and `mountpoint` is an existing
directory where the filesystem is to be mounted.
Mount options can be [some of these](http://blog.woralelandia.com/2012/07/16/fuse-mount-options/),
as also linked from the [fuse-bindings](https://www.npmjs.com/package/fuse-bindings#mount-options) readme.

### Use with macOS / OS X
You will need to install [OSXFuse](https://osxfuse.github.io/) and `pkg-config`.
If you use Homebrew, you can do this with `brew cask install osxfuse` and `brew install pkg-config`.
You will need to authorise the kext in System Preferences.

### Use within a docker container
Make sure you add the following params on the `docker run` command:
`--cap-add=MKNOD --cap-add=SYS_ADMIN --device=/dev/fuse`

### Things that work
* The root directory is now created automatically when you start mongofuse with
an empty database. This means you can actually try using it without manually
inserting stuff into MongoDB first!
* The usual reading, writing, creating, deleting, renaming etc. of files and directories
* chmod, chown, chgrp (including updating ctime)
* mknod (special files can be created, but can't be used with nodev in effect, see below)
* mtime/ctime update on file write
* atime update on file read, directory list, symlink resolution. atime/relatime/noatime options.
* symlinks and hardlinks (won't hardlink directories)
* File permissions enforced on open, truncate, ftruncate.
Directory permissions enforced on opendir.
access function is implemented.
You can't read from a fd opened with O_WRONLY and vice versa.
You can't chmod/chown/chgrp when you shouldn't be allowed to.
* Accepts basic FUSE mount options on the command line (eg. `-o allow_other`)
* The size is now stored explicitly in the inode, avoiding looking up
the data if it's only the attributes we're interested in.
* Extended attributes
* Works with macOS (using OSXFuse) as well as Linux

### Things that don't work / aren't present (yet)
* Directory permissions are partially but not fully enforced.
You can traverse and create/delete files in any directory,
although reading/listing permissions are enforced.
(Mounting with the `default_permissions` option is a possible solution.)
* Directory mtimes/ctimes aren't updated when a file is created.
* When I repeatedly `touch` a file without specifying a time, the atime/mtime
that are passed to my utimens function jump about non-monotonically over a
number of minutes. They can also be a number of minutes away from `Date.now()`
which is what the ctime gets set to. I don't think my filesystem is to blame.
* Files larger than just under 16MB, due to the maximum document size in MongoDB.
I now check for this and return EFBIG from ftruncate/truncate/write.
The solution to this is [GridFS](https://docs.mongodb.com/manual/core/gridfs/).
* Not yet tested on Windows, but may work with [Dokany](https://github.com/dokan-dev/dokany).
* Performance is probably pants, due to things like lack of caching,
and storing the data itself within the inode document.

---
_Source: https://npm.io/package/mongofuse · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
