forked from MoralisWeb3/youtube-tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
34 lines (25 loc) · 820 Bytes
/
index.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
const firebaseAdmin = require("firebase-admin");
const { v4: uuidv4 } = require("uuid");
const serviceAccount = require("./serviceAccount.json");
const admin = firebaseAdmin.initializeApp({
credential: firebaseAdmin.credential.cert(serviceAccount),
});
const storageRef = admin.storage().bucket("gs://moonnfts-d3cbe.appspot.com");
async function uploadFile(path, filename) {
const storage = storageRef.upload(path, {
public: true,
destination: `metadata/${filename}`,
metadata: {
metadata: {
firebaseStorageDownloadTokens: uuidv4(),
},
},
});
return storage
}
(async () => {
for (let i = 1; i < 11; i++) {
await uploadFile(`./metadata/${i}.json`, `${i}.json`);
console.log("Uploaded meta number " + i);
}
})();