ipfs-image-web-upload

Simple uploader/downloader for images stored on ipfs. Allows to upload pictures from html <input type="file" ...> and use them in <img src="..."> tag".


Keywords
ipfs, image, html, input, files, upload, download, loader, uploader, save, link
License
MIT
Install
npm install ipfs-image-web-upload@1.0.5

Documentation

ipfs-image-web-upload

Simple uploader/downloader for images stored on ipfs.

Allows to upload pictures from html <input type='file' ...> and use them in <img src='...'> tag.

Usage

To upload image from file input:

<input type='file' id='someFileInputId'>
var uploader = new IPFSUploader(new IPFS());
var file_input = document.getElementById("someFileInputId");
var hash = await uploader.uploadBlob(e.target.files[0]);

To set image to html img element:

<img id='output'>
var img_tag = document.querySelector( "#output" );
uploader.loadImage(img_tag, hash);