Skip to content

afeiship/next-blob2url

Repository files navigation

next-blob2url

Get blob url from blob.

version license size download

installation

npm install -S @jswork/next-blob2url

usage

import '@jswork/next-blob2url';

nx.blob2url(blob);
// http://localhost:5000/500e570a-ad09-4921-a4a3-6c72cc84626e
<div class="img-container">
  <img id="img" src="" alt="">
</div>

<script>
  fetch('./ava.jpg').then(res => res.blob()).then(res => {
    const url = nx.blob2url(res);
    document.getElementById('img').src = nx.blob2url(res)
    console.log(res, url);
  })
</script>

license

Code released under the MIT license.