@pipedream/dropbox 0.3.10 → 0.3.12
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.
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import dropbox from "../../dropbox.app.mjs";
|
|
2
|
+
import common from "../common/common.mjs";
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import { file } from "tmp-promise";
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
...common,
|
|
8
|
+
name: "Download File to TMP",
|
|
9
|
+
description: "Download a specific file to the temporary directory. [See the documentation](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesDownload__anchor).",
|
|
10
|
+
key: "dropbox-download-file-to-tmp",
|
|
11
|
+
version: "0.0.1",
|
|
12
|
+
type: "action",
|
|
13
|
+
props: {
|
|
14
|
+
dropbox,
|
|
15
|
+
path: {
|
|
16
|
+
propDefinition: [
|
|
17
|
+
dropbox,
|
|
18
|
+
"pathFile",
|
|
19
|
+
],
|
|
20
|
+
description: "The file path in the user's Dropbox to download.",
|
|
21
|
+
},
|
|
22
|
+
name: {
|
|
23
|
+
type: "string",
|
|
24
|
+
label: "File name",
|
|
25
|
+
description: "The new name of the file to be saved, including it's extension. e.g: `myFile.csv`",
|
|
26
|
+
optional: true,
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
async run({ $ }) {
|
|
30
|
+
const { result } = await this.dropbox.downloadFile({
|
|
31
|
+
path: this.getNormalizedPath(this.path, false),
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const {
|
|
35
|
+
path, cleanup,
|
|
36
|
+
} = await file();
|
|
37
|
+
|
|
38
|
+
const tmpPath = this.name
|
|
39
|
+
? `/tmp/${this.name}`
|
|
40
|
+
: path;
|
|
41
|
+
|
|
42
|
+
await fs.promises.appendFile(tmpPath, Buffer.from(result.fileBinary));
|
|
43
|
+
await cleanup();
|
|
44
|
+
|
|
45
|
+
delete result.fileBinary;
|
|
46
|
+
|
|
47
|
+
$.export("$summary", `File successfully saved in "/tmp/${this.name}"`);
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
tmpPath,
|
|
51
|
+
...result,
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import dropbox from "../../dropbox.app.mjs";
|
|
2
2
|
import consts from "../../common/consts.mjs";
|
|
3
3
|
import fs from "fs";
|
|
4
|
-
import got from "got";
|
|
4
|
+
import got from "got@12.4.1";
|
|
5
5
|
import common from "../common/common.mjs";
|
|
6
6
|
|
|
7
7
|
export default {
|
|
@@ -9,7 +9,7 @@ export default {
|
|
|
9
9
|
name: "Upload a File",
|
|
10
10
|
description: "Uploads a file to a selected folder. [See docs here](https://dropbox.github.io/dropbox-sdk-js/Dropbox.html#filesUpload__anchor)",
|
|
11
11
|
key: "dropbox-upload-file",
|
|
12
|
-
version: "0.0.
|
|
12
|
+
version: "0.0.7",
|
|
13
13
|
type: "action",
|
|
14
14
|
props: {
|
|
15
15
|
dropbox,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pipedream/dropbox",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.12",
|
|
4
4
|
"description": "Pipedream Dropbox Components",
|
|
5
5
|
"main": "dropbox.app.mjs",
|
|
6
6
|
"keywords": [
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"dropbox": "^10.34.0",
|
|
14
|
+
"tmp-promise": "^3.0.3",
|
|
14
15
|
"isomorphic-fetch": "^3.0.0",
|
|
15
16
|
"lodash": "^4.17.21"
|
|
16
17
|
},
|