imghdr:imghdr 模块确定文件或八位字节流中包含的图像类型(缓冲区的对象)

时间:2021-06-16 19:54:33
【文件属性】:
文件名称:imghdr:imghdr 模块确定文件或八位字节流中包含的图像类型(缓冲区的对象)
文件大小:445KB
文件格式:ZIP
更新时间:2021-06-16 19:54:33
JavaScript 图像 imghdr模块确定文件或八位字节流(缓冲区的对象)中包含的图像类型,其灵感来自 Python 的模块。 安装 npm install imghdr 用法 var imghdr = require ( 'imghdr' ) ; var imgPath = __dirname + '/meituan.jpg' ; var ext = 'jpg' ; var exts = imghdr . what ( imghdr ) ; console . log ( exts ) ; // => ['jpg', 'jpeg'] if ( exts . indexOf ( ext ) === - 1 ) { console . log ( 'The `' + imgPath + '`\'s extension is not a `' + ext + '`' ) ; } else {
【文件预览】:
imghdr-master
----.travis.yml(61B)
----package.json(780B)
----test()
--------test.js(3KB)
--------imgtype()
----LICENSE(1KB)
----.npmignore(27B)
----.gitignore(297B)
----imghdr.js(4KB)
----History.md(114B)
----README.md(3KB)

网友评论