小编mfa*_*aiz的帖子

使用Curl数据二进制选项,内存不足

我正在尝试使用curl来上传数据。我需要上传二进制数据。

不幸的是,我认为curl首先将文件二进制文件加载到内存中,因此对于大文件来说这是一个问题。我使用的系统的可用内存非常少,因此即使是 8mb 大的文件也很困难,我得到:

curl: option --data-binary: out of memory
curl: try 'curl --help' for more information
Run Code Online (Sandbox Code Playgroud)

我尝试过分块选项,但这似乎也不起作用。

到目前为止,这就是我正在尝试的:

curl --insecure -v --max-time 1200 ... --data-binary @/tmp/sd/record/....mp4 --header Transfer-Encoding: chunked -o UPLOAD_TOKEN -D Media_Binary_Data https://....upload
Run Code Online (Sandbox Code Playgroud)

有没有办法可以阻止文件将二进制文件加载到内存中或强制其将此数据存储在 SD 卡中并从那里读取数据?

bash shell curl google-api

10
推荐指数
1
解决办法
2万
查看次数

使用 JQ“包含”并在未找到密钥时抑制错误

我试图根据同一对象中另一个键的“包含”值来获取值

我已经尝试了一个代码,它可以工作并输出我想要的结果,但是 JSON 中的某些对象没有这个键,因此我得到:

jq: error (at <stdin>:1): null (null) and string ("BBC") cannot have their containment checked

或者这个错误的原因是其他键中的数组,我不确定

使用:

jq '.entries[] | select(.icon | contains("BBC")) | .uuid'

我希望找到的结果的 UUID 没有错误,并将其作为变量存储在 shell 中

"174501xxxxxxxxxxxxxe6342a03"

通过管道传输的输入文件

{  
   "entries":[  
      {  
         "uuid":"174501xxxxxxxxxxxxxe6342a03",
         "enabled":true,
         "autoname":true,
         "name":"BBC",
         "number":0,
         "icon":"file:///logos/BBC.png",
         "icon_public_url":"imagecache/1097",
         "epgauto":true,
         "epggrab":[  ],
         "dvr_pre_time":0,
         "dvr_pst_time":0,
         "epg_running":-1,
         "services":[  ],
         "tags":[  ],
         "bouquet":""
      },
      {  
         "uuid":"174501xxxxxxxxxxxxxe6342a04",
         "enabled":true,
         "autoname":true,
         "name":"ABC",
         "number":0,
         "icon_public_url":"imagecache/1098",
         "epgauto":true,
         "epggrab":[  ],
         "dvr_pre_time":0,
         "dvr_pst_time":0,
         "epg_running":-1,
         "services":[  ],
         "tags":[  ],
         "bouquet":""
      }...
Run Code Online (Sandbox Code Playgroud)

shell json try-catch jq

3
推荐指数
2
解决办法
4427
查看次数

在 Google 脚本中显示进度

我想向用户显示一个冗长脚本的进度。理想情况下,我想使用running script cancel dismiss运行 Google 脚本时出现的黄色吐司

我知道你可以抛出自定义错误,但如何将自定义消息抛出到这个黄色框。

或者另一种选择也可以。不是 msgbox,因为它会停止脚本。

javascript notifications google-sheets google-apps-script

1
推荐指数
1
解决办法
4565
查看次数