I have code that seems to work. But my Infura stats don’t show any traffic, and the Explorer says I have no Pins.
Here is my code:
const auth = 'Basic ' + projectId + ':' + projectSecret.toString('base64');
const client = await IpfsHttpClient.create({
host: 'ipfs.infura.io',
port: 5001,
protocol: 'https',
apiPath: '/api/v0',
headers: {
authorization: auth
}
})
const version = await client.version();
console.log("IPFS Node Version:", version.version);
for (var i = 0; i < input.files.length; ++i) {
console.log(input.files.item(i).name);
try {
const file = await client.add(input.files[i])
await client.pin.add(file.cid).then((res) => {
console.log('Results of Pin: ' + res)
})
console.log('https://ipfs.io/ipfs/' + file.path)
} catch (error) {
console.log(error)
}