flowbber.plugins.sinks.archive
¶This sink writes all collected data to a JSON file.
Important
This class inherits several inclusion and exclusion configuration options for filtering data before using it. See FilterSink Options for more information.
Dependencies:
pip3 install flowbber[archive]
Usage:
[[sinks]]
type = "archive"
id = "..."
[sinks.config]
output = "data.json"
encoding = "utf-8"
override = true
create_parents = true
pretty = false
compress = false
{
"sinks": [
{
"type": "archive",
"id": "...",
"config": {
"output": "data.json",
"encoding": "utf-8",
"override": true,
"create_parents": true,
"pretty": false,
"compress": false
}
}
]
}
Path to JSON file to write the collected data.
Default: N/A
Optional: False
Schema:
{
'type': 'string',
'empty': False,
}
Secret: False
Encoding to use to encode the file.
Default: utf-8
Optional: True
Schema:
{
'type': 'string',
'empty': False,
}
Secret: False
Override output file if already exists.
Default: False
Optional: True
Schema:
{
'type': 'boolean',
}
Secret: False
Create output file parent directories if don’t exist.
Default: False
Optional: True
Schema:
{
'type': 'boolean',
}
Secret: False
Compress the JSON output file in a Zip archive.
If using compression, the .zip
extension will be automatically appended
to the output
filename parameter if not present.
The created archive will contain a JSON file named as the output
parameter
without the .zip
extension. For example:
compress parameter |
output parameter |
Saved as | File inside Zip |
---|---|---|---|
True |
archive.json |
archive.json.zip |
archive.json |
True |
archive.json.zip |
archive.json.zip |
archive.json |
Compression uses Python’s ZipFile
module using the ZIP_DEFLATED
option,
thus requiring the zlib
module.
Default: False
Optional: True
Schema:
{
'type': 'boolean',
}
Secret: False
ArchiveSink
:
Common sink base class that adds several inclusion and exclusionflowbber.plugins.sinks.archive.
ArchiveSink
(index, type_, id_, optional=False, timeout=None, config=None)¶Inheritance