Downloading multiple PDFs to share


I’m trying to download around 4 pdfs and then share it via sharesheet to my computer. Unfortunately load() returns nothing. How do I get the raw data or save the raw data as a file?

const url = ""

log(Data.fromFile(url)) //returns null

let req = new Request(url)
let result = await req.load()
log(result) //is empty

  "headers": {
    "Cache-Control": "max-age=21600",
    "Etag": "\"33d0-438b181451e00\"",
    "Last-Modified": "Mon, 27 Aug 2007 17:15:36 GMT",
    "Content-Type": "application/pdf; qs=0.001",
    "content-security-policy": "upgrade-insecure-requests",
    "Expires": "Sat, 02 Mar 2019 01:47:35 GMT",
    "Accept-Ranges": "bytes",
    "Strict-Transport-Security": "max-age=15552000; includeSubdomains; preload",
    "Date": "Fri, 01 Mar 2019 19:47:35 GMT",
    "Content-Length": "13264"
  "url": "",
  "mimeType": "application/pdf",
  "statusCode": 200,
  "textEncodingName": null


log(result.getBytes()) // is not empty

Since result is a Data object, you need to use one of the get methods to log the data. But you should be able to save the request as a file directly using FileManager.write(path, result)


Ahhh, yes. I should have looked closer at the docs. Thank you!