@pipedream/google_drive 1.0.1 → 1.0.3

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.
@@ -18,7 +18,7 @@ export default {
18
18
  key: "google_drive-download-file",
19
19
  name: "Download File",
20
20
  description: "Download a file. [See the documentation](https://developers.google.com/drive/api/v3/manage-downloads) for more information",
21
- version: "0.1.10",
21
+ version: "0.1.12",
22
22
  type: "action",
23
23
  props: {
24
24
  googleDrive,
@@ -47,6 +47,7 @@ export default {
47
47
  directory](https://pipedream.com/docs/workflows/steps/code/nodejs/working-with-files/#the-tmp-directory)
48
48
  (e.g., \`/tmp/myFile.csv\`)
49
49
  `),
50
+ optional: true,
50
51
  },
51
52
  mimeType: {
52
53
  type: "string",
@@ -88,8 +89,24 @@ export default {
88
89
  });
89
90
  },
90
91
  },
92
+ syncDir: {
93
+ type: "dir",
94
+ accessMode: "write",
95
+ sync: true,
96
+ },
97
+ getBufferResponse: {
98
+ type: "boolean",
99
+ label: "Get Buffer Response",
100
+ description: "Whether to return the file content as a buffer instead of writing to a file path",
101
+ optional: true,
102
+ },
91
103
  },
92
104
  async run({ $ }) {
105
+ // Validate that filePath is provided when not getting raw response
106
+ if (!this.getBufferResponse && !this.filePath) {
107
+ throw new Error("File Path is required when not using Get Buffer Response");
108
+ }
109
+
93
110
  // Get file metadata to get file's MIME type
94
111
  const fileMetadata = await this.googleDrive.getFile(this.fileId, {
95
112
  fields: "name,mimeType",
@@ -113,6 +130,22 @@ export default {
113
130
  alt: "media",
114
131
  });
115
132
 
133
+ if (this.getBufferResponse) {
134
+ $.export("$summary", `Successfully retrieved raw content for file "${fileMetadata.name}"`);
135
+
136
+ // Convert stream to buffer
137
+ const chunks = [];
138
+ for await (const chunk of file) {
139
+ chunks.push(chunk);
140
+ }
141
+ const buffer = Buffer.concat(chunks);
142
+
143
+ return {
144
+ fileMetadata,
145
+ content: buffer,
146
+ };
147
+ }
148
+
116
149
  // Stream file to `filePath`
117
150
  const pipeline = promisify(stream.pipeline);
118
151
  const filePath = this.filePath.includes("tmp/")
@@ -120,7 +153,7 @@ export default {
120
153
  : `/tmp/${this.filePath}`;
121
154
  await pipeline(file, fs.createWriteStream(filePath));
122
155
  $.export("$summary", `Successfully downloaded the file, "${fileMetadata.name}"`);
123
- return {
156
+ return {
124
157
  fileMetadata,
125
158
  filePath,
126
159
  };
@@ -6,7 +6,7 @@ export default {
6
6
  key: "google_drive-update-file",
7
7
  name: "Update File",
8
8
  description: "Update a file's metadata and/or content. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/update) for more information",
9
- version: "2.0.0",
9
+ version: "2.0.1",
10
10
  type: "action",
11
11
  props: {
12
12
  googleDrive,
@@ -96,6 +96,12 @@ export default {
96
96
  Any additional parameters to pass in the request. [See the documentation](https://developers.google.com/drive/api/v3/reference/files/update#request-body) for all available parameters.
97
97
  `),
98
98
  },
99
+ syncDir: {
100
+ type: "dir",
101
+ accessMode: "read",
102
+ sync: true,
103
+ optional: true,
104
+ },
99
105
  },
100
106
  async run({ $ }) {
101
107
  const {
@@ -12,7 +12,7 @@ export default {
12
12
  key: "google_drive-upload-file",
13
13
  name: "Upload File",
14
14
  description: "Upload a file to Google Drive. [See the documentation](https://developers.google.com/drive/api/v3/manage-uploads) for more information",
15
- version: "2.0.1",
15
+ version: "2.0.2",
16
16
  type: "action",
17
17
  props: {
18
18
  googleDrive,
@@ -79,6 +79,12 @@ export default {
79
79
  description: "Additional metadata to supply in the upload. [See the documentation](https://developers.google.com/workspace/drive/api/reference/rest/v3/files) for information on available fields. Values will be parsed as JSON where applicable. Example: `{ \"description\": \"my file description\" }`",
80
80
  optional: true,
81
81
  },
82
+ syncDir: {
83
+ type: "dir",
84
+ accessMode: "read",
85
+ sync: true,
86
+ optional: true,
87
+ },
82
88
  },
83
89
  async run({ $ }) {
84
90
  const {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/google_drive",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Pipedream Google_drive Components",
5
5
  "main": "google_drive.app.mjs",
6
6
  "keywords": [