@pipedream/platerecognizer 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { checkTmp } from "../../common/utils.mjs";
|
|
1
|
+
import { getFileStream } from "@pipedream/platform";
|
|
3
2
|
import platerecognizer from "../../platerecognizer.app.mjs";
|
|
4
3
|
|
|
5
4
|
export default {
|
|
6
5
|
key: "platerecognizer-run-recognition",
|
|
7
6
|
name: "Run Recognition",
|
|
8
7
|
description: "Triggers a recognition process using the Plate Recognizer SDK.",
|
|
9
|
-
version: "0.0
|
|
8
|
+
version: "0.1.0",
|
|
10
9
|
type: "action",
|
|
11
10
|
props: {
|
|
12
11
|
platerecognizer,
|
|
13
12
|
imageFileOrUrl: {
|
|
14
13
|
type: "string",
|
|
15
|
-
label: "Image
|
|
16
|
-
description: "The image file or
|
|
14
|
+
label: "Image Path or URL",
|
|
15
|
+
description: "The image to be recognized. Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myImage.jpg`)",
|
|
17
16
|
},
|
|
18
17
|
regions: {
|
|
19
18
|
type: "string[]",
|
|
@@ -41,19 +40,18 @@ export default {
|
|
|
41
40
|
},
|
|
42
41
|
},
|
|
43
42
|
async run({ $ }) {
|
|
44
|
-
const fileObj = {};
|
|
45
43
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
fileObj.upload = Buffer(file).toString("base64");
|
|
44
|
+
const stream = await getFileStream(this.imageFileOrUrl);
|
|
45
|
+
const chunks = [];
|
|
46
|
+
for await (const chunk of stream) {
|
|
47
|
+
chunks.push(chunk);
|
|
51
48
|
}
|
|
49
|
+
const buffer = Buffer.concat(chunks);
|
|
52
50
|
|
|
53
51
|
const response = await this.platerecognizer.runRecognition({
|
|
54
52
|
$,
|
|
55
53
|
data: {
|
|
56
|
-
|
|
54
|
+
upload: buffer.toString("base64"),
|
|
57
55
|
regions: this.regions,
|
|
58
56
|
camera_id: this.cameraId,
|
|
59
57
|
mmc: this.mmc,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/platerecognizer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Pipedream Plate Recognizer Components",
|
|
5
5
|
"main": "platerecognizer.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
"access": "public"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@pipedream/platform": "^1.
|
|
16
|
+
"@pipedream/platform": "^3.1.0"
|
|
17
17
|
}
|
|
18
18
|
}
|