Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const pinFileToIPFS = async () => {
- try {
- const formData = new FormData();
- // Convert the image file to a stream
- const imageStream = streamifier.createReadStream(PinnieImage);
- // Append the stream to FormData
- formData.append('file', imageStream, { filename: 'Pinnie.png' });
- // Now you can use formData for your IPFS request or any other purpose
- } catch (error) {
- console.error('Error pinning file to IPFS:', error);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement