Skip to main content

googledrive@3.0.0

create(content, fileName, options)
get(fileIdOrName)
list(folderId, [options])
update(fileId, content)

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.

ParamTypeDescription
contentstringBase64 encoded file content.
fileNamestringName for the uploaded file.
optionsObjectFile upload parameters.
[options.folderId]stringID of the parent folder.

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
referencesan 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.

ParamTypeDescription
fileIdOrNamestringID of the file or its name to download.

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
referencesan 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.

ParamTypeDescription
folderIdstringID of the folder to list files from. If not provided, lists files from the root.
[options]ObjectOptions for listing files
[options.fields]stringFields to return in the response. Defaults to 'files(id, name, mimeType, createdTime, modifiedTime)'.
[options.query]stringCustom query string for filtering files (see Google Drive API query syntax).
[options.limit]numberMaximum number of files to return
[options.orderBy]stringOrder in which to sort the results. Defaults to 'modifiedTime desc'.

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
referencesan 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.

ParamTypeDescription
fileIdstringID of the file to update.
contentstringBase64 encoded new content.

This operation writes the following keys to state:

State KeyDescription
datathe parsed response body
referencesan array of all previous data objects used in the Job

Example: Update a file

update('1B1dHwY2uLgm_-U96LNl9zFsRYq8953jL', 'SGVsbG8gTWlrZQ==');