Last active
September 3, 2021 13:07
-
-
Save polluterofminds/14cce6e693460f80b60b686fc15c9abf to your computer and use it in GitHub Desktop.
Generate Metadata
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const faker = require('faker'); | |
const TOTAL = 4; | |
const folderCIDForImages = "YOUR_IMAGE_FOLDER_CID"; | |
const gatewayCustomDomain = "YOUR_CUSTOM_GATEWAY_DOMAIN" | |
const generateRandomMetadata = (id) => { | |
return { | |
name: faker.name.findName(), | |
description: faker.lorem.sentences(), | |
image: `${gatewayCustomDomain}/ipfs/${folderCIDForImages}/${id}` | |
} | |
} | |
(async () => { | |
for(let i=1; i < TOTAL + 1; i++) { | |
const metadata = generateRandomMetadata(i) | |
fs.writeFileSync(`./metadata/${i}`, JSON.stringify(metadata)); | |
} | |
console.log("Done!"); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment