# localstorage-fs

> node's fs module for the browser backed by localStorage

Latest version **0.1.0** (published 2014-01-08) · WTFPL license · 0 weekly downloads

## Install

```sh
npm install localstorage-fs
pnpm add localstorage-fs
yarn add localstorage-fs
bun add localstorage-fs
```

## 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.1.0 |
| Published | 2014-01-08 |
| First published | 2014-01-05 |
| Weekly downloads | 0 |
| License | WTFPL |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Jesse Tane |
| Maintainers | jessetane |

## Links

- npm: https://www.npmjs.com/package/localstorage-fs
- npm.io page: https://npm.io/package/localstorage-fs

## Dependencies (3)

- [process](https://npm.io/package/process.md) ~0.5.1
- [fs-stats](https://npm.io/package/fs-stats.md) ~0.0.0
- [inherits](https://npm.io/package/inherits.md) ~2.0.1

## Recent versions

- 0.1.0 (latest) — 2014-01-08
- 0.0.3 — 2014-01-07
- 0.0.2 — 2014-01-07
- 0.0.1 — 2014-01-05
- 0.0.0 — 2014-01-05

## README

# localstorage-fs
node's [`fs`](http://nodejs.org/api/fs.html) module backed by [`localStorage`](http://www.w3.org/TR/webstorage/#the-localstorage-attribute)

[![Browser Support](http://ci.testling.com/jessetane/localstorage-fs.png)](http://ci.testling.com/jessetane/localstorage-fs)

## why
[this](https://github.com/juliangruber/level-fs-browser) would be way better, but i needed the sync methods

## how
browserify and use like you would in node land

## api coverage
* `fs.rename(oldPath, newPath, callback)`
* `fs.renameSync(oldPath, newPath)`
* `fs.truncate(path, len, callback)`
* `fs.truncateSync(path, len)`
* `fs.chmod(path, mode, callback)`
* `fs.chmodSync(path, mode)`
* `fs.stat(path, callback)`
* `fs.statSync(path)`
* `fs.unlink(path, callback)`
* `fs.unlinkSync(path)`
* `fs.rmdir(path, callback)`
* `fs.rmdirSync(path)`
* `fs.mkdir(path, callback)`
* `fs.mkdirSync(path, mode)`
* `fs.readdir(path, callback)`
* `fs.readdirSync(path)`
* `fs.readFile(path, options, callback)`
* `fs.readFileSync(path, options)`
* `fs.writeFile(path, data, options, callback)`
* `fs.writeFileSync(path, data, options)`
* `fs.appendFile(path, data, options, callback)`
* `fs.appendFileSync(path, data, options)`
* `fs.exists(path, callback)`
* `fs.existsSync(path)`
* `fs.createWriteStream(path, options)`
* `fs.createReadStream(path, options)`

others that could probably be implemented [here](https://github.com/jessetane/localstorage-fs/blob/master/index.js#L235)

## tests / example
* get browserify
* get bash
* `npm run test`
* `npm run example`

## implementation
* file data and directory listings are keyed by `'/path/name'` under the prefix: `'file://'`
* meta data (also keyed by path name) is stored as JSON stringified `fs.Stats` instances under `'file-meta://'`
* file contents are stored as base64 encoded strings which means binary files work
* directory listings are stored as newline delimited plain strings (like `ls(1)`)
* async methods are faked with `process.nextTick`
* streams are faked by buffering into memory

## notes
* some `fs` related [`process`](https://github.com/jessetane/localstorage-fs/blob/master/index.js#L547) methods are shimmed out by this module for now

## license
WTFPL

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