The JavaScript example is correct, but you have to make sure that you only use gapi.client.drive.files
(and the other Drive-specific resources) when the Drive library is loaded, i.e. after:
gapi.client.load('drive', 'v2', callback);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…