import * as fs from 'fs'; import Arweave from 'arweave'; async function uploadImageToArweave (){ console.log("init"); const arweave = Arweave.init({ host: 'arweave.net', port: 443, protocol: 'https', timeout: 20000, logging: false, }); // Upload image to Arweave const data = fs.readFileSync('./image.jpg'); const transaction = await arweave.createTransaction({ data: data }); transaction.addTag('Content-Type', 'image/jpg'); //SETUP YOUR ARWEAVE WALLET await arweave.transactions.sign(transaction, "CLAVE PRIVADA DE ARWEAVE WALLET JSON sin EL ext:true"); const response = await arweave.transactions.post(transaction); console.log(response); const imageUrl = transaction.id ? `https://arweave.net/${transaction.id}` : undefined; console.log(imageUrl); } uploadImageToArweave();