Gathering detailed insights and metrics for image2uri
Gathering detailed insights and metrics for image2uri
Gathering detailed insights and metrics for image2uri
Gathering detailed insights and metrics for image2uri
npm install image2uri
Typescript
Module System
Node Version
NPM Version
97.6
Supply Chain
96.8
Quality
75.6
Maintenance
100
Vulnerability
100
License
TypeScript (100%)
Total Downloads
2,757,600
Last Day
3,686
Last Week
33,619
Last Month
150,221
Last Year
1,436,965
MIT License
10 Stars
55 Commits
1 Forks
2 Watchers
3 Branches
2 Contributors
Updated on Feb 06, 2025
Latest Version
2.1.2
Package Id
image2uri@2.1.2
Unpacked Size
8.94 kB
Size
3.42 kB
File Count
7
NPM Version
9.8.1
Node Version
18.18.2
Published on
Nov 27, 2023
Cumulative downloads
Total Downloads
Last Day
-48.9%
3,686
Compared to previous day
Last Week
3.8%
33,619
Compared to previous week
Last Month
-3.7%
150,221
Compared to previous month
Last Year
56.4%
1,436,965
Compared to previous year
1
2
Convert image file to data URI. Support .png
,.gif
,.jpg
,.jpeg
,.bm
,.bmp
,.webp
,.ico
,.svg
.
This package is ESM only: Node 12+ is needed to use it and it must be import instead of require.
1npm i image2uri
1const recursiveReaddirFiles = await import('image2uri'); 2 3// Fix compiling in typescript. 4// https://github.com/microsoft/TypeScript/issues/43329#issuecomment-922544562 5const { getExt, recursiveReaddirFiles } = await (Function('return import("image2uri")')()) as Promise<typeof import("image2uri")>;
1import image2uri from "image2uri"; 2 3console.log(image2uri('./example.bmp')); 4// data:image/bmp;base64,Qk0YCAAAAAAAADYAAAAoAAAAGAAAABwAAAABABgAAAAAAOIHAAA.... 5console.log(image2uri('./example.jpg')); 6// data:image/jpeg;base64,Qk0YCAAAAAAAADYAAAAoAAAAGAAAABwAAAABABgAAAAAAOIHAAA.... 7 8const uri = await image2uri('https://avatars.githubusercontent.com/u/1680273?v=4', { ext: '.apng' }); 9// data:image/apng;base64,/9j/2wCEAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDc 10const avatar = await image2uri('https://avatars.githubusercontent.com/u/1680273?v=4'); 11// /9j/2wCEAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDc
1export declare const validUrl: (url: string) => boolean; 2export declare const extTypeMap: { 3 '.png': string; 4 '.apng': string; 5 '.gif': string; 6 '.jpg': string; 7 '.jpeg': string; 8 '.bm': string; 9 '.bmp': string; 10 '.webp': string; 11 '.ico': string; 12 '.svg': string; 13}; 14export type ExtType = keyof typeof extTypeMap; 15export default function image2uri(file: string, options?: { 16 ext?: string; 17}): string | Promise<string>;
1npm run watch # Listen compile .ts files. 2npm run build # compile .ts files. 3 4npm run start
As always, thanks to our amazing contributors!
Made with action-contributors.
Licensed under the MIT License.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
packaging workflow detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Score
Last Scanned on 2025-04-28
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More