Google Cloud Storage在文件中查找 [英] Google Cloud Storage seeking within files

查看:101
本文介绍了Google Cloud Storage在文件中查找的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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.

这篇关于Google Cloud Storage在文件中查找的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆