zoukankan      html  css  js  c++  java
  • 前端获取文件的sha1值

    项目需求,需要获取文件的sha1值,网上很多获取文件md5值和base64的方法,但很难找到关于前端获取文件sha1值的方法,最后在github上找到一个插件能够获取文件的sha1值;

    https://jackytck.github.io/sha1-file-web

    下面在vue里面使用的例子,

    npm install sha1-file-web --save;

    import sha1 from 'sha1-file-web';

    <input type="file" @change="img_sha1($event)" />

    img_sha1(files){  

      const file = files.target.files[0];
      test(file);

      asyc function test(file){

        const hash = await sha1(file);

        //hash即得到的sha1值

      }

    }

  • 相关阅读:
    个人博客
    个人博客
    个人博客
    个人博客
    个人博客
    团队作业—个人记录
    4.21
    4.20
    4.19
    4.18
  • 原文地址:https://www.cnblogs.com/niuxiaoxian/p/10130352.html
Copyright © 2011-2022 走看看