谷歌云存储在文件中寻找 [英] Google Cloud Storage seeking within files
问题描述
Google App Engine 网站 (https://developers.google.com/appengine/docs/python/googlestorage/functions#seek) 提示能够在 Google Cloud Storage 上的文件中查找.但是,在 Google Cloud Storage API 页面上没有可以搜索的迹象.
The Google App Engine website (https://developers.google.com/appengine/docs/python/googlestorage/functions#seek) hints at being able to seek within files on Google Cloud Storage. However, on the Google Cloud Storage API pages there is no sign of being able to seek.
我想知道是否可以使用 API 从非 Google App Engine 服务器搜索存储在 Google Cloud Storage 上的文件.
I wondered if it is possible to seek within files stored on Google Cloud Storage using the API, from non Google App Engine servers.
推荐答案
使用 范围标题来做到这一点.
Use the Range header to do this.
下面会得到六个字节10、11、12、13、14和15.
The following will get six bytes 10, 11, 12, 13, 14 and 15.
curl -v -H "Range: bytes=10-15" http://storage.googleapis.com/pub/gsutil.tar.gz
> GET /pub/gsutil.tar.gz HTTP/1.1
> Host: storage.googleapis.com
> Accept: */*
> Range: bytes=10-15
>
HTTP/1.1 206 Partial Content
< Content-Range: bytes 10-15/1092318
< Content-Length: 6
{ [data not shown]
字节从 0 到(长度 - 1)开始.所以一个 5 字节的文件包含字节 0、1、2、3 和 4.
Bytes start at 0 to (length - 1). So a 5 byte file contains bytes 0, 1, 2, 3 and 4.
这篇关于谷歌云存储在文件中寻找的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!