Package Exports
- @sheetbase/drive-server
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@sheetbase/drive-server) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Sheetbase Module: @sheetbase/drive-server
File management with Drive for Sheetbase backend app.
Install
Using npm: npm install --save @sheetbase/drive-server
import * as Drive from "@sheetbase/drive-server";As a library: 1mbpy4unOm6RTKzU_awPJnt9mNncpFPXR9f3redN5YavB8PSYUDKe8Fo8
Set the Indentifier to DriveModule and select the lastest version, view code.
declare const DriveModule: { Drive: any };
const Drive = DriveModule.Drive;Scopes
https://www.googleapis.com/auth/drive
Usage
Docs homepage: https://sheetbase.github.io/drive-server
API reference: https://sheetbase.github.io/drive-server/api
Examples
import * as Drive from "./public_api";
// content folder: https://drive.google.com/drive/folders/1PZm1HEpCNUV3gR5DVq1PuULLs_dnvhdY?usp=sharing
const contentFolder = "1PZm1HEpCNUV3gR5DVq1PuULLs_dnvhdY";
function load_() {
return Drive.drive({ contentFolder });
}
export function example1(): void {
const Drive = load_();
const text = Drive.get("1QKOvTtyGgZdY_QD6KHZ662ScNhZQhgtI"); // file.txt
const image = Drive.get("147iOWt3-4aNaTqSrGLP8Wl-DgPxCaD1t"); // image.jpg
Logger.log(text);
Logger.log(image);
}
export function example2(): void {
const Drive = load_();
const result1 = Drive.upload({
name: "file.txt",
mimeType: "text/plain",
base64Content: "SGVsbG8sIHdvcmxkIQ=="
});
const result2 = Drive.upload(
{
name: "file.txt",
mimeType: "text/plain",
base64Content: "SGVsbG8sIHdvcmxkIQ=="
},
"my_folder"
);
const result3 = Drive.upload(
{
name: "file.txt",
mimeType: "text/plain",
base64Content: "SGVsbG8sIHdvcmxkIQ=="
},
null,
"AUTO"
);
const result4 = Drive.upload(
{
name: "file.txt",
mimeType: "text/plain",
base64Content: "SGVsbG8sIHdvcmxkIQ=="
},
null,
"MD5"
);
Logger.log(result1);
Logger.log(result2);
Logger.log(result3);
Logger.log(result4);
}License
@sheetbase/drive-server is released under the MIT license.