googledrive@3.0.0
This adaptor exports the following from common:
- alterState
- arrayToString()
- as()
- chunk()
- combine()
- cursor()
- dataPath()
- dataValue()
- dateFns
- each()
- field()
- fields()
- fn()
- fnIf()
- lastReferenceValue()
- merge()
- parseCsv()
- sourceValue()
- util
Functions
create
create(content, fileName, options) ⇒ Operation
Uploads a file to Google Drive.
| Param | Type | Description |
|---|---|---|
| content | string | Base64 encoded file content. |
| fileName | string | Name for the uploaded file. |
| options | Object | File upload parameters. |
| [options.folderId] | string | ID of the parent folder. |
This operation writes the following keys to state:
| State Key | Description |
|---|---|
| data | the parsed response body |
| references | an array of all previous data objects used in the Job |
Example: Upload a file to a root folder
create("SGVsbG8gV29ybGQ=", "hello-world.txt");
Example: Upload a file to a specificfolder
create("SGVsbG8gV29ybGQ=", "hello-world.txt", {
folderId: "15tLwRj0lmr4mGIslEm5QEAS8YJ1EAXep",
});
get
get(fileIdOrName) ⇒ Operation
Downloads a file from Google Drive.
Returns: Operation - An operation that retrieves the file as a base64 string.
| Param | Type | Description |
|---|---|---|
| fileIdOrName | string | ID of the file or its name to download. |
This operation writes the following keys to state:
| State Key | Description |
|---|---|
| data | the parsed response body |
| references | an array of all previous data objects used in the Job |
Example: Download a file
get('1B1dHwY2uLgm_-U96LNl9zFsRYq8953jL')
Example: Download a file by name
get('hello-world.txt')
list
list(folderId, [options]) ⇒ Operation
Lists files from a directory or root.
Returns: Operation - An operation that retrieves a list of files.
| Param | Type | Description |
|---|---|---|
| folderId | string | ID of the folder to list files from. If not provided, lists files from the root. |
| [options] | Object | Options for listing files |
| [options.fields] | string | Fields to return in the response. Defaults to 'files(id, name, mimeType, createdTime, modifiedTime)'. |
| [options.query] | string | Custom query string for filtering files (see Google Drive API query syntax). |
| [options.limit] | number | Maximum number of files to return |
| [options.orderBy] | string | Order in which to sort the results. Defaults to 'modifiedTime desc'. |
This operation writes the following keys to state:
| State Key | Description |
|---|---|
| data | the parsed response body |
| references | an array of all previous data objects used in the Job |
Example: List files of a directory
list({folderId: '<id-of-folder-here>'})
Example: List files at the root of google drive
list()
update
update(fileId, content) ⇒ Operation
Updates an existing file in Google Drive.
| Param | Type | Description |
|---|---|---|
| fileId | string | ID of the file to update. |
| content | string | Base64 encoded new content. |
This operation writes the following keys to state:
| State Key | Description |
|---|---|
| data | the parsed response body |
| references | an array of all previous data objects used in the Job |
Example: Update a file
update('1B1dHwY2uLgm_-U96LNl9zFsRYq8953jL', 'SGVsbG8gTWlrZQ==');