Storage Quick Start¶
Import pattern¶
Use your configured Apps Script library identifier (recommended: ASTLib) and normalize once:
Configure runtime defaults¶
Load script properties once at startup if you want shared defaults:
function configureStorageRuntime() {
const ASTX = ASTLib.AST || ASTLib;
ASTX.Storage.configure(PropertiesService.getScriptProperties().getProperties());
}
Supported script property keys:
GCS_SERVICE_ACCOUNT_JSONS3_ACCESS_KEY_IDS3_SECRET_ACCESS_KEYS3_SESSION_TOKENS3_REGIONS3_ENDPOINTDATABRICKS_HOSTDATABRICKS_TOKEN
List objects¶
function storageListExample() {
const ASTX = ASTLib.AST || ASTLib;
const out = ASTX.Storage.list({
uri: 'gcs://my-bucket/project/',
options: {
recursive: false,
pageSize: 200
}
});
Logger.log(JSON.stringify(out.output.items));
}
Read object¶
function storageReadExample() {
const ASTX = ASTLib.AST || ASTLib;
const out = ASTX.Storage.read({
uri: 's3://my-bucket/config/settings.json'
});
Logger.log(out.output.data.mimeType);
Logger.log(JSON.stringify(out.output.data.json || out.output.data.text));
}
Write object¶
function storageWriteExample() {
const ASTX = ASTLib.AST || ASTLib;
ASTX.Storage.write({
uri: 'dbfs:/mnt/project/output/run.json',
payload: {
json: {
runAt: new Date().toISOString(),
status: 'ok'
}
},
options: {
overwrite: true
}
});
}
Delete object¶
function storageDeleteExample() {
const ASTX = ASTLib.AST || ASTLib;
ASTX.Storage.delete({
uri: 'gcs://my-bucket/tmp/old-file.txt'
});
}
Exists check¶
function storageExistsExample() {
const ASTX = ASTLib.AST || ASTLib;
const out = ASTX.Storage.exists({
uri: 's3://my-bucket/config/settings.json'
});
Logger.log(out.output.exists.exists); // true/false
}
Copy / move¶
function storageCopyMoveExample() {
const ASTX = ASTLib.AST || ASTLib;
ASTX.Storage.copy({
fromUri: 'gcs://my-bucket/inbound/run.json',
toUri: 'gcs://my-bucket/archive/run.json'
});
ASTX.Storage.move({
fromUri: 'dbfs:/mnt/staging/a.csv',
toUri: 'dbfs:/mnt/processed/a.csv'
});
}
Signed URL¶
function storageSignedUrlExample() {
const ASTX = ASTLib.AST || ASTLib;
const out = ASTX.Storage.signedUrl({
uri: 's3://my-bucket/reports/latest.csv',
options: {
method: 'GET',
expiresInSec: 900
}
});
Logger.log(out.output.signedUrl.url);
}
Multipart write¶
function storageMultipartWriteExample() {
const ASTX = ASTLib.AST || ASTLib;
ASTX.Storage.multipartWrite({
uri: 's3://my-bucket/large/events.ndjson',
payload: {
text: '...large content...'
},
options: {
partSizeBytes: 5 * 1024 * 1024
}
});
}
Behavior notes¶
- Not found in
head,read, ordeletethrowsAstStorageNotFoundError. existsreturnsoutput.exists.exists=falsefor missing objects.copy/moverequires same-providerfromUriandtoUri.- Payloads are normalized to base64 internally (
text/jsonare helper inputs). - Config resolution precedence: request auth >
ASTX.Storage.configure(...)> script properties.