# file-file-system

> A filesystem, but in a file

Latest version **1.3.1** (published 2022-07-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install file-file-system
pnpm add file-file-system
yarn add file-file-system
bun add file-file-system
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.3.1 |
| Published | 2022-07-20 |
| First published | 2022-03-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 42.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kale Ko |
| Maintainers | kale-ko |
| Keywords | file, system, filesystem, fs, storage, files |

## Links

- npm: https://www.npmjs.com/package/file-file-system
- Repository: https://github.com/Kale-Ko/File-File-System
- Homepage: https://github.com/Kale-Ko/File-File-System#readme
- Issues: https://github.com/Kale-Ko/File-File-System/issues
- npm.io page: https://npm.io/package/file-file-system

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.3.1 (latest) — 2022-07-20
- 1.2.0 — 2022-03-10
- 1.1.0 — 2022-03-10
- 1.0.2 — 2022-03-10
- 1.0.1 — 2022-03-10
- 1.0.0 — 2022-03-10

## README

# File File System

File File System works similarly to the fs module but everything is saved inside a file on the disk

Currently it supports:

- Creating/Loading multiple file systems
- Basic file actions (create, delete, read, write, append, rename, copy)
- Base file queries (exists, stat)
- Basic directory actions (list)
- Fetching file system info

## Setup

To setup simply type `npm install file-file-system --save` in a console

Then in your script add `const { FileFileSystem } = require("file-file-system")`

## Creating a file file system

To create a file system you just need to instantiate a FileFileSystem object. `const fileSystem = FileFileSystem.createIfNotExist(fileName)`\
You may also use `FileFileSystem.create(fileName)` and `FileFileSystem.load(fileName)` but you must check if the filesystem exists or not first.

## Methods

Get disk meta - `var meta = fileSystem.diskMeta()`\
Save to disk - `fileSystem.save()`\
Reload from disk - `fileSystem.reload()`

Check if file exists - `var exists = fileSystem.exists(file)`\
Get file info - `var stat = fileSystem.statFile(file)`

Create file - `fileSystem.createFile(file)`\
delete file - `fileSystem.deleteFile(file)`

Read from file - `var content = fileSystem.readFile(file)`\
Read directory contents - `var files = fileSystem.readDir(dir)`\
Write to file - `fileSystem.writeFile(file, content)`\
Append to file - `fileSystem.appendFile(file, content)`

Rename/Move file - `fileSystem.rename(file, newFile)`\
Copy file - `fileSystem.copy(source, dest)`

## Open Options

`autoSave` - Wether or not to automatically save the file to disk for you whenever you modify a file - Default true

## Options

`format` - The file system format (Normal, Flat) - Default normal
`fileSize` - The size the file is allowed to take up on the real disk (In kilobytes) - Default 64000 (64mb)

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