Hi folks,
I’m trying to use the IPFS endpoint for adding/pinning content, but keep running in to the same error:
'invalid path "hello world": selected encoding not supported'
Below is my typescript code
import FormData from 'form-data';
async function test() {
const auth = Buffer.from('projectId:projectSecret').toString('base64');
const formData = new FormData();
formData.append('test', Buffer.from('hello world'));
const resp = await fetch('https://ipfs.infura.io:5001/api/v0/pin/add', {
method: 'post',
headers: { authorization: `Basic ` + auth, ...formData.getHeaders() },
body: formData,
});
console.log(resp);
}
test();