下面的代码直接来自 google apis github用于从 GCS 下载文件。我将其更改为能够将文件下载到我的本地计算机。
如果文件大于 33MB,应用程序将在 2 分钟或更短的时间内停止尝试。我想我读到应用程序引擎的限制是 32 或 33。不过,我没有看到配额有任何增加。有人能指出我如何管理这个问题的正确方向吗?
if (blob.getSize() < 1_000_000) {
// Blob is small read all its content in one request
byte[] content = blob.getContent();
outStream.write(content);
outStream.close();
} else {
// When Blob size is big or unknown use the blob's channel reader.
try (ReadChannel reader = blob.reader()) {
WritableByteChannel channel = Channels.newChannel(outStream);
ByteBuffer bytes = ByteBuffer.allocate(64 * 1024);
while (reader.read(bytes) > 0) {
bytes.flip();
channel.write(bytes);
bytes.clear();
}
}
}
最佳答案
App Engine 的最大文件大小为 32 MB(Golang 环境除外,该文件大小为 64 MB)。您无法从 Google Cloud Storage(或任何来源)下载大于此大小的文件。部署应用程序时,您也不能在部署中包含大于 32 MB 的文件。这已记录在案here 。查找标题为静态数据限制
关于java - App Engine 无法下载超过 33MB 的文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53105488/