-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstorage.js
52 lines (36 loc) · 1.32 KB
/
storage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
'use strict';
async function quickstart(
projectId = 'extro-1612581033896', // Your Google Cloud Platform project ID
keyFilename = 'src/elements/gcl.json' //Full path of the JSON file
) {
// Imports the Google Cloud client library
const {Storage} = require('@google-cloud/storage');
// Creates a client
const storage = new Storage({keyFilename,projectId});
const bucket = storage.bucket('deepturn_assets')
// const storage = require('@google-cloud/storage');
// const projectId = 'extro-1612581033896';
// const gcs = storage({
// projectId: projectId
// });
// let bucketName = 'deepturn_assets';
// let bucket = gcs.bucket(bucketName);
// bucket.getFiles({}, (err, files,apires) => {console.log(err,files,apires)});
// /**
// * TODO(developer): Uncomment the following lines before running the sample.
// */
// // The ID of your GCS bucket
// const bucketName = 'your-unique-bucket-name';
// // Imports the Google Cloud client library
// const {Storage} = require('@google-cloud/storage');
// // Creates a client
// const storage = new Storage();
// async function listFiles() {
// // Lists files in the bucket
// const [files] = await storage.bucket(bucketName).getFiles();
// console.log('Files:');
// files.forEach(file => {
// console.log(file.name);
// });
// }
// listFiles().catch(console.error);