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`.
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.
Source Distribution
filee-0.0.5.tar.gz
(4.1 kB
view details)
Built Distribution
filee-0.0.5-py3-none-any.whl
(6.2 kB
view details)
File details
Details for the file filee-0.0.5.tar.gz
.
File metadata
- Download URL: filee-0.0.5.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3eb40725a9f7cb9292e07a29f8462cd528a8a68f26e3194807ed5e5a57883bdb |
|
MD5 | b8985ea789129a04fd19f0d22a5a6d2b |
|
BLAKE2b-256 | 7228010be1829b432c58ec229d640b16e7fc47314564b3d68fd60652a0940d1d |
File details
Details for the file filee-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: filee-0.0.5-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf92f91a6c56a863a115394af322268448c70af966381e33b5c9b66beb47aebd |
|
MD5 | dc003f6528ba1bb02a6ca15ea6c8fbe7 |
|
BLAKE2b-256 | b70b52487cf35ff364716b32d09fd5f3fbb4d9e83c53cc629367bd197920b152 |