I\'m aware that in the Google Drive API you can request to get a portion of a file within a certain range: Range: bytes=500-999, but I was looking in the Google
If my understanding is correct, how about this answer? Please think of this as just one of several possible answers.
In order to achieve the partial download, please use Range: bytes=500-999 at the request headers.
As a simple sample script, how about the following script? In this script, the partial download from 100 bytes to 200 bytes is run for a file of file ID using Drive API.
var fileId = "###"; // Please set the file ID.
var start = 100;
var end = 199;
var url = "https://www.googleapis.com/drive/v3/files/" + fileId + "?alt=media";
var params = {
method: "get",
headers: {
Authorization: "Bearer " + ScriptApp.getOAuthToken(),
Range: "bytes=" + start + "-" + end,
},
};
var bytes = UrlFetchApp.fetch(url, params).getContent();
Logger.log(bytes.length)
100 can be seen at the log.0.If I misunderstood your question and this was not the direction you want, I apologize.
When I tested the maximum size of the byte array, I could notice that the specification had been changed. So I add it as the updated specification.
Before: The maximum blob size is 52,428,800 bytes. Accurately, when the blob more than 50 MB is converted to the byte array, an error occurs. By this, when the byte array of 50 MB is added to the byte array of 50 MB, an error related to the maximum size occurs. This was my experimental result I measured before.
Now: Now, when I tested this situation again, although the file of 52,428,801 bytes cannot be retrieved as the byte array (this is the same specification. The maximum blob size is 52,428,800 bytes.), I noticed that the byte array of 52,428,800 bytes got to be able to be added to the byte array of 52,428,800 bytes. By this, I could confirm that the byte array of 104,857,600 could be created.