Skip to main content

A command to save / load files with JSON input / output.

Project description

# filee

A command to save/load files from/to JSON.

```bash
$ filee load | python -m json.tool
{
"children": [
{
"name": "README.md",
"content": "# filee\n\nREADME\n",
"too_big": false,
"binary": false,
"read_only": false,
"changed": true,
"children": null
}
],
"name": "",
"content": null,
"too_big": false,
"binary": false,
"read_only": false,
"changed": true
}
```

## File tree JSON format

### Files

```json
{
"name": "README.md",
"content": "# filee\n\nREADME\n",
"too_big": false,
"binary": false,
"read_only": false,
"changed": true,
"children": null
}
```

The content will be encoded by `FTREE_ENCODING`.
If files are binary file, they will be encoded by BASE64.

### Directory

```json
{
"children": [
{ },
{ }
],
"name": "dirname",
"content": null,
"too_big": false,
"binary": false,
"read_only": false,
"changed": true
}
```

The `name` of root directory will be empty string (`''`).

## Load Command

`load` command loads data from file system and send it to the stdout as JSON.
The JSON will be formed as above file tree format.

```bash
$ filee load
```

* `--dir`: Target directory to load. default is current directory.
* `--etag`: Load only changed files.

### Etag behavior

By usinig `--etag` option, the command will return only changed files.
It will save hashes of each files in `FTREE_LOAD_FILE_HASHES` setting path,
and recognize files are changed from last loading or not.

```json
{
"name": "README.md",
"content": null,
"too_big": false,
"binary": false,
"read_only": false,
"changed": false,
"children": null
}
```

This option can reduce the size of JSON output.

## Save Command

`save` command accepts JSON input from stdin, and saves files to your file system.
The JSON should be formed as above file tree format.

```bash
$ filee save
```

## Settings

You can specify settings for filee command by environment variables:

* `FTREE_ENCODING`: Save/Load encoding. default is `"utf-8"`
* `FTREE_MAX_SIZE`: Max file size (bytes) to load. default is 1MB.
* `FTREE_MAX_CHILDREN`Max number of children of directories. default is 50.
* `FTREE_MAX_DEPTH`: Max number of depth of directory tree. default is 20.
* `FTREE_LOAD_FILE_HASHES`: File path to save hashes of loading. default is `~/.fileeloadhashes`.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for filee, version 0.0.5
Filename, size File type Python version Upload date Hashes
Filename, size filee-0.0.5-py3-none-any.whl (6.2 kB) File type Wheel Python version 3.7 Upload date Hashes View hashes
Filename, size filee-0.0.5.tar.gz (4.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page