久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

谷歌應(yīng)用程序腳本從二進(jìn)制文件中獲取字節(jié)范圍

Google apps script get range of bytes from binary file(谷歌應(yīng)用程序腳本從二進(jìn)制文件中獲取字節(jié)范圍)
本文介紹了谷歌應(yīng)用程序腳本從二進(jìn)制文件中獲取字節(jié)范圍的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我知道在 Google Drive API 您可以請(qǐng)求獲取某個(gè)范圍內(nèi)的文件的一部分:Range: bytes=500-999,但我正在查看 Google Apps 腳本參考,我似乎在其中找不到等效函數(shù).

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 Apps Script reference and I couldn't seem to find the equivalent function in there.

有人有什么想法嗎?

推薦答案

  • 您想要檢索文件的部分正文.
  • 您希望使用 Google Apps 腳本實(shí)現(xiàn)此目的.
  • 如果我的理解是正確的,那么這個(gè)答案呢?請(qǐng)認(rèn)為這只是幾個(gè)可能的答案之一.

    If my understanding is correct, how about this answer? Please think of this as just one of several possible answers.

    為了實(shí)現(xiàn)部分下載,請(qǐng)?jiān)谡?qǐng)求標(biāo)頭處使用 Range: bytes=500-999.

    In order to achieve the partial download, please use Range: bytes=500-999 at the request headers.

    作為一個(gè)簡(jiǎn)單的示例腳本,下面的腳本怎么樣?在此腳本中,使用 Drive API 為文件 ID 的文件運(yùn)行從 100 字節(jié)到 200 字節(jié)的部分下載.

    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)
    

    • 運(yùn)行腳本時(shí),可以在日志中看到100.
    • 很重要的一點(diǎn),第一個(gè)字節(jié)的范圍是0.
    • 另外一點(diǎn)很重要,在 Google Apps 腳本中,blob 的最大大小為 50 MB(52,428,800 字節(jié)).所以也請(qǐng)注意這一點(diǎn).
      • 作為另一個(gè)示例腳本,this怎么樣?
      • 部分下載
      • 類 UrlFetchApp

      如果我誤解了您的問(wèn)題并且這不是您想要的方向,我深表歉意.

      If I misunderstood your question and this was not the direction you want, I apologize.

      當(dāng)我測(cè)試字節(jié)數(shù)組的最大大小時(shí),我注意到規(guī)范已經(jīng)改變.所以我將其添加為更新的規(guī)范.

      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.

      • 之前:最大 Blob 大小為 52,428,800 字節(jié).準(zhǔn)確的說(shuō),當(dāng)超過(guò)50MB的blob轉(zhuǎn)換為字節(jié)數(shù)組時(shí),就會(huì)出現(xiàn)錯(cuò)誤.這樣,當(dāng)將 50MB 的字節(jié)數(shù)組添加到 50MB 的字節(jié)數(shù)組時(shí),就會(huì)發(fā)生與最大大小有關(guān)的錯(cuò)誤.這是我之前測(cè)量的實(shí)驗(yàn)結(jié)果.

      • 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.

      現(xiàn)在: 現(xiàn)在,當(dāng)我再次測(cè)試這種情況時(shí),雖然無(wú)法將 52,428,801 字節(jié)的文件作為字節(jié)數(shù)組檢索(這是相同的規(guī)范.最大 blob 大小為 52,428,800字節(jié).),我注意到 52,428,800 字節(jié)的字節(jié)數(shù)組必須能夠添加到 52,428,800 字節(jié)的字節(jié)數(shù)組中.至此,我可以確認(rèn)可以創(chuàng)建 104,857,600 的字節(jié)數(shù)組.

      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.

      這篇關(guān)于谷歌應(yīng)用程序腳本從二進(jìn)制文件中獲取字節(jié)范圍的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

      【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 頻道中的消息?)
how to make my bot mention the person who gave that bot command(如何讓我的機(jī)器人提及發(fā)出該機(jī)器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復(fù)必須使用導(dǎo)入來(lái)加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來(lái)自特定服務(wù)器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復(fù)“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務(wù)器時(shí)的歡迎消息)
主站蜘蛛池模板: 成人欧美一区二区三区视频xxx | 成人欧美一区二区三区黑人孕妇 | 亚洲一级视频在线 | 91av在线看| 欧美成人黄色小说 | 日韩at| 亚洲精品视频免费 | 亚州无限乱码 | 中文在线一区二区 | 国产精品18hdxxxⅹ在线 | 久久久久国产一区二区三区四区 | 久久av一区二区三区 | 91视视频在线观看入口直接观看 | 天堂久久av | 欧美v日韩| 婷婷综合色 | 秋霞a级毛片在线看 | 欧美视频中文字幕 | 欧美日产国产成人免费图片 | 成av人电影在线 | 日本国产高清 | 欧美成人精品在线观看 | 污污免费网站 | 欧美一区二区在线视频 | 成人精品啪啪欧美成 | 91精品国产乱码久久久 | 国产91丝袜在线播放 | 欧美一区二区成人 | 狠狠躁天天躁夜夜躁婷婷老牛影视 | 亚洲午夜av久久乱码 | 成人午夜精品 | 国产精品一卡二卡三卡 | av资源中文在线天堂 | 日韩视频二区 | 日韩精品一区在线 | 国产探花在线精品一区二区 | 成人在线免费电影 | 成人国产免费视频 | 日韩精品 电影一区 亚洲 | 81精品国产乱码久久久久久 | 久久成人精品视频 |