Metadata Tagging
Bundlr supports attaching metadata tags to each transaction.
Tags can be used to:
- Categorize transactions, making it easier to search for and retrieve relevant information using GraphQL
- Build provenance chains for Proof Of Provenance applications
- Inform web browsers how to render image files
Content-Type
When uploading a file that will be rendered by the browser, you must specify the content-type (MIME type) (opens in a new tab).
// Your file
const fileToUpload = "./myImage.png";
// Add a custom tag that tells the browser how to properly render the file
const tags = [{ name: "Content-Type", value: "image/png" }];
try {
const response = await bundlr.uploadFile(fileToUpload, tags);
console.log(`File uploaded ==> https://arweave.net/${response.id}`);
} catch (e) {
console.log("Error uploading file ", e);
}
Application
You can label your application name, which is helpful if you need to filter transactions by application.
// Your file
const fileToUpload = "./myNFT.png";
const tags = [
{ name: "Content-Type", value: "image/png" },
{ name: "appName", value: "NFTs To The Moon" },
];
try {
const response = await bundlr.uploadFile(fileToUpload, tags);
console.log(`File uploaded ==> https://arweave.net/${response.id}`);
} catch (e) {
console.log("Error uploading file ", e);
}
Custom
You can use any custom tags your use case requires.