Skip to content

Instantly share code, notes, and snippets.

@polluterofminds
Last active September 3, 2021 13:07
Show Gist options
  • Save polluterofminds/14cce6e693460f80b60b686fc15c9abf to your computer and use it in GitHub Desktop.
Save polluterofminds/14cce6e693460f80b60b686fc15c9abf to your computer and use it in GitHub Desktop.
Generate Metadata
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