1.1.5 • Published 5 months ago

files-bytes v1.1.5

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

file-bytes

  • Obtain the true type of file

install

npm i file-bytes
yarn add file-bytes
pnpm install file-bytes

Introduction and use, using Vue as an example

<template>

  <input type="file" @change="handelFiles" />
</template>

<script lang="ts" setup>
import { checkFileType } from "/npm/file-bytes";

function handelFiles(file: any) {
  const { files } = file.target;
  checkFileType(files[0]).then((res: string) => {
    /**
     * If the second parameter is not passed, the true type of the file will be returned. If false is returned,
     * it indicates that the file type has not been added to the library and will continue to be added later
     */
    console.log(res);//'.png'|'.js'|'.mp4'|......
  });
  checkFileType(files[0],".png").then((res: string) => {
    /**
     * If the second parameter is passed, it indicates that you predicted the file type you selected.
     * If the actual file type does not match the predicted type,
     * it will return true. Otherwise, it will return false
     */
    console.log(res);//true | false
  });
}
</script>

Due to the large number of file types, apart from common file types, if you are unable to verify your files, it indicates that the tool has not been included, and you may need to contact the developer for assistance

Contact me

email:1920872385@qq.com | qq:1920872385

more

Git See alsogithub

1.1.5

5 months ago

1.1.4

5 months ago

1.1.3

8 months ago

1.1.2

8 months ago

1.1.1

8 months ago

1.1.0

8 months ago

1.0.9

8 months ago

1.0.8

8 months ago

1.0.7

8 months ago

1.0.6

8 months ago

1.0.5

8 months ago

1.0.4

8 months ago

1.0.3

8 months ago

1.0.2

8 months ago

1.0.1

8 months ago

1.0.0

8 months ago