SuperFetch Plugins: Apps Script streaming with Tank and Drive

39 views
Skip to first unread message

Bruce Mcpherson

unread,
Aug 30, 2022, 10:12:04 AM8/30/22
to Google Apps Script Community
Tank and Drv are SuperFetch plugins to emulate streaming and use the Drive REST API with Apps Script. SuperFetch is a proxy for UrlFetchApp with additional features – see SuperFetch – a proxy enhancement to Apps Script UrlFetch (https://ramblings.mcpher.com/apps-script/superfetch-proxy/plugins-tank/) for how it works and what it does.

This is another in my series on SuperFetch plugins.

Tank, Streaming and Drv

You can see more about Pseudo streaming for Apps Script (it doesn’t support real streaming natively), at SuperFetch Tank Plugin: Streaming for Apps Script (https://ramblings.mcpher.com/apps-script/superfetch-proxy/plugins-tank/)

This article will cover how to copy very large files using Tank to stream and Drv to upload and download partial content. The Apps Script Drive services have a limit on the size of files you can write, and very large memory usage can potentially cause Apps Script to fall over mysteriously – like this – ‘The JavaScript runtime exited unexpectedly”

UrlFetch also has a maximum payload size of 50mb (it used to be 10mb), but in reality I’ve found it can drop bytes (the number of bytes in the payload received doesn’t match that reported in the response header) on payloads of over about 20mb.

You can also use SuperFetch Tank to stream between Drive and Google Cloud Storage (with more platforms in future releases). SuperFetch has a Cloud storage plugin (gcs) which I’ll cover in another article

For full details see https://ramblings.mcpher.com/apps-script/superfetch-proxy/streaming-tank-drv/
Reply all
Reply to author
Forward
0 new messages