Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const pinFileToIPFS = async () => {
- try {
- const formData = new FormData();
- formData.append('file', await fetch('./assets/Pinnie.png').then((res) => res.blob()));
- // Now you can use formData for your API request, e.g., send it to the server or IPFS
- // Example using fetch:
- // const response = await fetch('your-api-endpoint', {
- // method: 'POST',
- // body: formData,
- // });
- // Handle the response as needed
- } catch (error) {
- console.error('Error pinning file to IPFS:', error);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement