0.0.10 • Published 1 year ago

browser-media-tool v0.0.10

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago
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