使用Node.js检查文件在GCS存储桶中的名称是否存在

我想知道Google Cloud Storage是否提供了一种有效的方法来检查具有给定名称的文件是否存在于具有node.js的给定存储桶中。 诸如bucket.fileExists('someName')将是理想的。 我很抱歉,如果有明显的答案。 任何build设性的反馈将不胜感激。

他们添加了file.exists()方法。

 const fileExists = _=>{ return file.exists().then((data)=>{ console.log(data[0]); }); } fileExists(); //logs a boolean to the console; //true if the file exists; //false if the file doesn't exist.