Skip to main content

googledrive@1.1.0

create(content, fileName, options)
get(fileIdOrName)
update(fileId, content)

This adaptor exports the following from common:

alterState()
arrayToString()
as()
chunk()
combine()
cursor()
dataPath()
dataValue()
dateFns
each()
field()
fields()
fn()
fnIf()
http
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')

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==');