Skip to content

Commit 3d6ce07

Browse files
committed
Updating _2markdown and mapbox
1 parent 1aef040 commit 3d6ce07

File tree

6 files changed

+16
-20
lines changed

6 files changed

+16
-20
lines changed

components/_2markdown/_2markdown.app.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ export default {
66
propDefinitions: {
77
filePath: {
88
type: "string",
9-
label: "File Path",
10-
description: "The path to an HTML file in the `/tmp` directory. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp)",
9+
label: "File Path or URL",
10+
description: "An HTML file. Provide either the path to a file in the `/tmp` directory (e.g. `/tmp/myFile.ext`) or a file URL. [See the documentation on working with files](https://pipedream.com/docs/workflows/building-workflows/code/nodejs/working-with-files/)",
1111
},
1212
},
1313
methods: {

components/_2markdown/actions/html-file-to-markdown/html-file-to-markdown.mjs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import _2markdown from "../../_2markdown.app.mjs";
2-
import fs from "fs";
2+
import { getFileStream } from "@pipedream/platform";
33
import FormData from "form-data";
44

55
export default {
66
key: "_2markdown-html-file-to-markdown",
77
name: "HTML File to Markdown",
88
description: "Convert an HTML file to Markdown format. [See the documentation](https://2markdown.com/docs#file2md)",
9-
version: "0.0.1",
9+
version: "0.1.0",
1010
type: "action",
1111
props: {
1212
_2markdown,
@@ -20,9 +20,7 @@ export default {
2020
async run({ $ }) {
2121
const form = new FormData();
2222

23-
form.append("document", fs.createReadStream(this.filePath.includes("tmp/")
24-
? this.filePath
25-
: `/tmp/${this.filePath}`));
23+
form.append("document", await getFileStream(this.filePath));
2624

2725
const response = await this._2markdown.htmlFileToMarkdown({
2826
$,

components/_2markdown/actions/pdf-to-markdown/pdf-to-markdown.mjs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import _2markdown from "../../_2markdown.app.mjs";
2-
import fs from "fs";
2+
import { getFileStream } from "@pipedream/platform";
33
import FormData from "form-data";
44

55
export default {
66
key: "_2markdown-pdf-to-markdown",
77
name: "PDF to Markdown",
88
description: "Convert a PDF document to Markdown format. [See the documentation](https://2markdown.com/docs#pdf2md)",
9-
version: "0.0.1",
9+
version: "0.1.0",
1010
type: "action",
1111
props: {
1212
_2markdown,
@@ -15,7 +15,7 @@ export default {
1515
_2markdown,
1616
"filePath",
1717
],
18-
description: "The path to a PDF file in the `/tmp` directory. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp)",
18+
description: "A PDF file. Provide either the path to a file in the `/tmp` directory (e.g. `/tmp/myFile.pdf`) or a file URL. [See the documentation on working with files](https://pipedream.com/docs/workflows/building-workflows/code/nodejs/working-with-files/)",
1919
},
2020
waitForCompletion: {
2121
type: "boolean",
@@ -27,9 +27,7 @@ export default {
2727
async run({ $ }) {
2828
const form = new FormData();
2929

30-
form.append("document", fs.createReadStream(this.filePath.includes("tmp/")
31-
? this.filePath
32-
: `/tmp/${this.filePath}`));
30+
form.append("document", await getFileStream(this.filePath));
3331

3432
let response = await this._2markdown.pdfToMarkdown({
3533
$,

components/_2markdown/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/_2markdown",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "Pipedream 2markdown Components",
55
"main": "_2markdown.app.mjs",
66
"keywords": [

components/mapbox/actions/create-tileset/create-tileset.mjs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import mapbox from "../../mapbox.app.mjs";
2-
import fs from "fs";
2+
import { getFileStream } from "@pipedream/platform";
33
import FormData from "form-data";
44

55
export default {
66
key: "mapbox-create-tileset",
77
name: "Create Tileset",
88
description: "Uploads and creates a new tileset from a data source. [See the documentation](https://docs.mapbox.com/api/maps/mapbox-tiling-service/)",
9-
version: "0.0.1",
9+
version: "0.1.0",
1010
type: "action",
1111
props: {
1212
mapbox,
@@ -22,8 +22,8 @@ export default {
2222
},
2323
filePath: {
2424
type: "string",
25-
label: "File Path",
26-
description: "The path to a tileset source file in the `/tmp` directory. [See the documentation on working with files](https://pipedream.com/docs/code/nodejs/working-with-files/#writing-a-file-to-tmp)",
25+
label: "File Path or URL",
26+
description: "A tileset source file. Provide either the path to a file in the `/tmp` directory (e.g. `/tmp/myFile.ext`) or a file URL. [See the documentation on working with files](https://pipedream.com/docs/workflows/building-workflows/code/nodejs/working-with-files/)",
2727
},
2828
recipe: {
2929
type: "object",
@@ -51,7 +51,7 @@ export default {
5151
// Create Tileset Source
5252
try {
5353
const fileData = new FormData();
54-
const content = fs.createReadStream(filePath);
54+
const content = await getFileStream(filePath);
5555
fileData.append("file", content);
5656

5757
await this.mapbox.createTilesetSource({

components/mapbox/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/mapbox",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "Pipedream Mapbox Components",
55
"main": "mapbox.app.mjs",
66
"keywords": [

0 commit comments

Comments
 (0)