Closed jinfahua closed 3 years ago
Image sink is used for saving pictures into specified folders.
# cd $kuiper_src
# go build --buildmode=plugin -o plugins/sinks/Image.so plugins/sinks/image.go
# cp plugins/sinks/Image.so $kuiper_install/plugins/sinks
Reboot Kuiper to activate plugin.
Name | Optional | Description |
---|---|---|
path | N | Path for saving pictures, such as /tmp |
maxAge | N | Expired time for picture files. Default value is 72 hours, which means that the images files can be saved by 3 days. |
Below demo describes saving picture into /tmp
folder every 5 seconds, and delete images files that are expired after 72hrs.
{
"sql": "SELECT * from demo",
"actions": [
{
"image": {
"path": "/tmp",
"maxAge":72
}
}
]
}
下面示例演示接收图片并将图片保存到文件夹 /tmp
中,同时将保存时长超过72小时的图片删除。
{
"sql": "SELECT * from demo",
"actions": [
{
"image": {
"path": "/tmp",
"format": "png",
"filePrefix":"image"
"maxage":72
}
}
]
}
属性名称 | 是否可选 | 说明 |
---|---|---|
path | 是 | 保存结果的文件夹路径,例如 /tmp |
format | 否 | 文件格式,支持 jpeg 和 png。 |
maxAge | 是 | 最长文件存储时间(小时)。默认值为72,这表示图片最多保存3天。 |
filePrefix | 是 | 图片文件名前缀,默认为 image,文件格式样例为 image_2020-12-12_11-15-23-345.png |
Kuiper Binary Support
bytea
typeDatatype
bytea
is a sequence of bytes, aka. byte array. The impelmentation is[]byte
in golang.Stream/Source
binary
formatAdd new format
binary
in stream definition:Validate for this format:
self
.Soure node decode binary format
Each source needs to check format type and do decoding accordingly.
Soure node decode json format with binary field
Image Processing Function
Validates the argument
col
's type, must be byteaSink