googledrive@1.0.0
Functions
create
create(content, fileName, options) ⇒ function
Uploads a file to Google Drive.
Returns: function
- An operation that uploads the file.
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. |
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(fileId) ⇒ function
Downloads a file from Google Drive.
Returns: function
- An operation that retrieves the file as a base64 string.
Param | Type | Description |
---|---|---|
fileId | string | ID of the file to download. |
Example: Download a file
get('1B1dHwY2uLgm_-U96LNl9zFsRYq8953jL')
update
update(fileId, content, options) ⇒ function
Updates an existing file in Google Drive.
Returns: function
- An operation that updates the file.
Param | Type | Description |
---|---|---|
fileId | string | ID of the file to update. |
content | string | Base64 encoded new content. |
options | Object | File update options. |
Example: Update a file
update('1B1dHwY2uLgm_-U96LNl9zFsRYq8953jL', 'SGVsbG8gTWlrZQ==');