Google Cloud Storage忽略定界符
我正在尝试从Google云存储中检索JSON文件.JSON文件与相应的音频文件存储在同一文件夹中,如下所示:
I am trying to retrive JSON files from google cloud storage. The JSON files are stored in the same folder as their corresponding audio files, as follows:
bucket
folder1
audio.wav
audio.json
folder2
audio.wav
audio.json
我正在使用nodejs,并按以下方式调用云存储:
I'm using nodejs, and calling cloud storage as follows:
bucket.getFiles({
delimeter: 'audio' //should be preventing loading of audio files but it isnt
}).then((data) => {
console.log(data)
}).catch((error) => {
console.log(error)
})
我觉得这可能与Google处理文件夹的方式有关,但我不确定.首先是文件的存储方式:
I have a feeling it might be related to how Google handles folders, but I'm not really sure. Here is how the files are being stored in the first place:
const storage = require('@google-cloud/storage')();
const filename = `recordings/${path.parse(req.body.RecordingUrl).name}/audio.wav`;
const file = storage
.bucket(config.RESULTS_BUCKET)
.file(filename)
这将导致某种形式的字符串,该字符串为音频文件分配唯一的ID作为文件夹名称,然后附加/audio.wav
,并且云存储以某种方式将其识别为文件夹.只是一个猜测,但不确定是否可以解决.有人知道我可能在做错什么吗?
Which results in some sort of string that assigns the audio file a unique ID as the folder name, and then appends the /audio.wav
, and somehow cloud storage recognizes that as a folder. Just a guess, but not sure how to solve that if it's the case. Anyone know what I might be doing wrong?
如果您试图列出所有以 .json
结尾的对象,那么您不想在以下位置设置定界符全部.定界符用于分层列表.您几乎永远都不想将其设置为unset和/
以外的任何值.请参见列表文档.
If you're trying to list all objects that end in .json
, then you don't want to set a delimiter at all. The delimiter is used for hierarchical listing. You almost never want to set it to any values other than unset and /
. See list documentation.