Skip to content

Commit 9e11477

Browse files
committed
add: fileforge
1 parent d174051 commit 9e11477

File tree

3 files changed

+8
-18
lines changed

3 files changed

+8
-18
lines changed

components/fileforge/actions/generate-pdf/generate-pdf.mjs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
import FormData from "form-data";
2-
import fs from "fs";
3-
import {
4-
checkTmp,
5-
parseObject,
6-
} from "../../common/utils.mjs";
2+
import { getFileStream } from "@pipedream/platform";
3+
import { parseObject } from "../../common/utils.mjs";
74
import fileforge from "../../fileforge.app.mjs";
85

96
export default {
107
key: "fileforge-generate-pdf",
118
name: "Generate PDF",
129
description: "Generate a PDF from provided HTML. [See the documentation](https://docs.fileforge.com/api-reference/api-reference/pdf/generate)",
13-
version: "0.0.1",
10+
version: "0.1.0",
1411
type: "action",
1512
props: {
1613
fileforge,
@@ -27,8 +24,8 @@ export default {
2724
},
2825
files: {
2926
type: "string[]",
30-
label: "HTML Files",
31-
description: "The HTML files to convert to PDF. Each file should be a valid path to an HTML file saved to the `/tmp` directory (e.g. `/tmp/image.png`). [See the documentation](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory)..",
27+
label: "File Paths or URLs",
28+
description: "The HTML files to convert to PDF. For each entry, provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.pdf`)",
3229
},
3330
test: {
3431
type: "boolean",
@@ -66,7 +63,7 @@ export default {
6663
const parsedFiles = parseObject(files);
6764

6865
for (const file of parsedFiles) {
69-
formData.append("files", fs.createReadStream(checkTmp(file)));
66+
formData.append("files", await getFileStream(file));
7067
}
7168

7269
formData.append("options", JSON.stringify({

components/fileforge/common/utils.mjs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,3 @@ export const parseObject = (obj) => {
2222
}
2323
return obj;
2424
};
25-
26-
export const checkTmp = (filename) => {
27-
if (!filename.startsWith("/tmp")) {
28-
return `/tmp/${filename}`;
29-
}
30-
return filename;
31-
};

components/fileforge/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/fileforge",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "Pipedream Fileforge Components",
55
"main": "fileforge.app.mjs",
66
"keywords": [
@@ -13,7 +13,7 @@
1313
"access": "public"
1414
},
1515
"dependencies": {
16-
"@pipedream/platform": "^3.0.1",
16+
"@pipedream/platform": "^3.1.0",
1717
"form-data": "^4.0.0"
1818
}
1919
}

0 commit comments

Comments
 (0)