browser-media-tool
TypeScript icon, indicating that this package has built-in type declarations

0.0.10 • Public • Published
npm install browser-media-tool / yarn add browser-media-tool

a tool for get media info, such as width、height、ratio, if media is image, can even get base64 by set option base64 = true

methods

  • getMediaInfoByFile(file: File)

return Promise -> {width: number, height: number, ratio: number, base64: string, file: File}

  • getImageInfoByUrl(url: string, base64: boolean)

return Promise -> {width: number, height: number, ratio: number, url: string} if you set base64 is true, return Promise -> {width: number, height: number, ratio: number, base64: string, url: string}

  • getVideoInfoByUrl(url: string)

return Promise -> {width: number, height: number, ratio: number, url: string}

if your project UI has waterfall, and medias without width and height props, you can set by yourself with this library

Package Sidebar

Install

npm i browser-media-tool

Weekly Downloads

0

Version

0.0.10

License

MIT

Unpacked Size

6.59 kB

Total Files

8

Last publish

Collaborators

  • a-drowned-fish