Giter VIP home page Giter VIP logo

next-base64-download's Introduction

next-base64-download

Download base64 file from browser.

installation

npm install -S afeiship/next-base64-download --registry=https://registry.npm.taobao.org

usage

<div class="container" id="ctr">
  <img
    src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACIAAAAaCAYAAADSbo4CAAAAAXNSR0IArs4c6QAAAdVJREFUSA3tlz9IQlEUh31S0VRhUyAVBG3hFrQ4R05BEOHa2tTS2hZFTS0NrQpNzY0F0dASBBFBQ4QOkUNDZUSv78A7z/uuT5+GLx088HHPPff8+fGeXjSRwFzXTUMBSvBfJrNkZlo0OJ5zg5+SQBeswsyMCCngrHVBgDmyKK/FfB1L5mmcPnNzoFaSJ+IaA4cdx6ka+9hcxg7S/EsHJNXx1gcS1mHAind0S/8VGt4FmhIMMxGUB1tooLbdDf0W4BLqTD4jzeyWw+V2B9r59JiBk2aDbCFbJL+GFFwTW7QHRO2pScEBVMG0TzZ7ZiAgRBpzOALb8GYmev4Fa7YFAUPkbULFq9PlB6cI094sjbt1QnQIGeOwC+9+ds05w53XXHMlvgqPtVTfO8cL1PgnOA2FaHNyJuAQ7MdLyD2FLIyB3AtXYNs9gdDPmZkYKcQQNEXhMXybDZr4L5xtgNwXoWbWtixEO1E8CwWQ9x1mHwR3YFRrGq1mcdtCtClN5uAInkCGy92zD5OaE7WS61vgiud6d6KKO3kuKrRfR29ObfqXtS/Efmr9J9LTT6Ss6vg25dSPe7VmlXvmx7MIkf8VXf87keQyfUZIBorgvyb8uE1mycyMaPgFt6B66p+59h8AAAAASUVORK5CYII="
  />
</div>
const ctr = document.getElementById('ctr');
const img = document.querySelector('img');

ctr.onclick = function(params) {
  nx.base64Download({
    b64: img.src,
    filename: 'your-name.png'
  });
};

next-base64-download's People

Contributors

afeiship avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.