{"name":"favicons","version":"7.3.0","keywords":["favicon","ico","generator","node","realfavicongenerator"],"author":{"name":"Hayden Bleasel","email":"haydenbleasel@gmail.com"},"license":"MIT","_id":"favicons@7.3.0","maintainers":[{"name":"andy128k","email":"andy128k@gmail.com"},{"name":"brunocodutra","email":"brunocodutra@gmail.com"},{"name":"evilebottnawi","email":"sheo13666q@gmail.com"}],"homepage":"https://github.com/itgalaxy/favicons","bugs":{"url":"https://github.com/itgalaxy/favicons/issues"},"dist":{"shasum":"4692d8e2f2e3027b35902a8dd33b4f7bc363e0af","tarball":"http://registry-npm.ywwl.com/favicons/download/favicons-7.3.0.tgz","fileCount":7,"integrity":"sha512-4v42LShwdrw059EpUOhUiehMD3mEfzqo1w92GvN5FSJlursP5H0NhUskTvxxbSWiYUctOg3qpLL/onQ+JwBVYg==","signatures":[{"sig":"MEQCIBgMbWB917fc5xfi2qThvQCfNODR/Cn/GnouNZq3Ulr4AiBO1fdvkVtMmcFGss/U3E9UufWymBNvFENafn6JQM9VjA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":79101,"size":20836,"noattachment":false,"key":"/favicons/-/favicons-7.3.0.tgz"},"jest":{"testMatch":["<rootDir>/test/**/*.test.mjs"],"testTimeout":180000,"collectCoverage":true,"coverageDirectory":"<rootDir>/coverage","coverageReporters":["text-summary","html"],"setupFilesAfterEnv":["<rootDir>/test/setup.mjs"],"collectCoverageFrom":["src/**/*.ts","src/**/*.js"],"extensionsToTreatAsEsm":[".ts"]},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.mts","module":"./dist/index.mjs","engines":{"node":">=20.0.0"},"exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs","require":"./dist/index.cjs"}},"gitHead":"4bac89c0a95e5afde44d28d8a216df680db7c430","scripts":{"fix":"npm run lint -- --fix && npm run fmt","fmt":"prettier --write .","lint":"eslint src test","test":"cross-env NODE_OPTIONS=--experimental-vm-modules jest","build":"tsdown","clean":"rimraf dist/","pretest":"npm run lint && npm run fmt-check","prebuild":"npm run clean","test-all":"npm test && npm run test-import && npm run test-require","fmt-check":"prettier --check .","typecheck":"tsc","test-import":"node ./test-packages/test-mjs/index.js","test-require":"node ./test-packages/test-cjs/index.js","prepublishOnly":"npm run build && npm run test-all"},"_npmUser":{"name":"andy128k","email":"andy128k@gmail.com"},"repository":{"url":"git+https://github.com/itgalaxy/favicons.git","type":"git"},"_npmVersion":"11.14.1","description":"Favicon generator for Node.js","directories":{},"_nodeVersion":"24.11.1","dependencies":{"sharp":"^0.34.1","xml2js":"^0.6.1","escape-html":"^1.0.3"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^30.4.2","icojs":"^1.0.0","unrun":"^0.3.0","eslint":"^10.4.0","rimraf":"^6.0.1","tsdown":"^0.22.0","globals":"^17.6.0","prettier":"^3.0.0","cross-env":"^10.1.0","@eslint/js":"^10.0.1","typescript":"^6.0.3","@babel/core":"^7.19.6","@types/xml2js":"^0.4.11","@babel/preset-env":"^7.19.4","typescript-eslint":"^8.32.0","@types/escape-html":"^1.0.2","eslint-plugin-jest":"^29.11.2","jest-image-snapshot":"^6.1.0","eslint-config-prettier":"^10.1.5","eslint-plugin-prettier":"^5.0.0","@babel/preset-typescript":"^7.18.6"},"_npmOperationalInternal":{"tmp":"tmp/favicons_7.3.0_1779953214074_0.30361362558045557","host":"s3://npm-registry-packages-npm-production"},"readme":"# Favicons\n\n[![NPM version](https://img.shields.io/npm/v/favicons.svg)](https://www.npmjs.org/package/favicons)\n[![Build Status](https://github.com/itgalaxy/favicons/actions/workflows/ci.yml/badge.svg)](https://github.com/itgalaxy/favicons/actions/workflows/ci.yml)\n\nA **Node.js module** for generating favicons and their associated files. Originally built for [Google's Web Starter Kit](https://github.com/google/web-starter-kit) and [Catalyst](https://github.com/haydenbleasel/catalyst). Installed through NPM with:\n\n```\nnpm install favicons\n```\n\n## Usage\n\nTo use Favicons, require the appropriate module and call it, optionally specifying configuration and callback objects. A sample is shown on the right. The full list of options can be found on GitHub.\n\nFavicons generates its icons locally using pure Javascript with no external dependencies.\n\nPlease note: Favicons is tested on Node 14 and above.\n\n```js\nimport { favicons } from \"favicons\";\n\nconst source = \"test/logo.png\"; // Source image(s). `string`, `buffer` or array of `string`\n\nconst configuration = {\n  path: \"/\", // Path for overriding default icons path. `string`\n  appName: null, // Your application's name. `string`\n  appShortName: null, // Your application's short_name. `string`. Optional. If not set, appName will be used\n  appDescription: null, // Your application's description. `string`\n  developerName: null, // Your (or your developer's) name. `string`\n  developerURL: null, // Your (or your developer's) URL. `string`\n  cacheBustingQueryParam: null, // Query parameter added to all URLs that acts as a cache busting system. `string | null`\n  dir: \"auto\", // Primary text direction for name, short_name, and description\n  lang: \"en-US\", // Primary language for name and short_name\n  background: \"#fff\", // Background colour for flattened icons. `string`\n  theme_color: \"#fff\", // Theme color user for example in Android's task switcher. `string`\n  appleStatusBarStyle: \"black-translucent\", // Style for Apple status bar: \"black-translucent\", \"default\", \"black\". `string`\n  display: \"standalone\", // Preferred display mode: \"fullscreen\", \"standalone\", \"minimal-ui\" or \"browser\". `string`\n  orientation: \"any\", // Default orientation: \"any\", \"natural\", \"portrait\" or \"landscape\". `string`\n  scope: \"/\", // set of URLs that the browser considers within your app\n  start_url: \"/?homescreen=1\", // Start URL when launching the application from a device. `string`\n  preferRelatedApplications: false, // Should the browser prompt the user to install the native companion app. `boolean`\n  relatedApplications: undefined, // Information about the native companion apps. This will only be used if `preferRelatedApplications` is `true`. `Array<{ id: string, url: string, platform: string }>`\n  version: \"1.0\", // Your application's version string. `string`\n  pixel_art: false, // Keeps pixels \"sharp\" when scaling up, for pixel art.  Only supported in offline mode.\n  loadManifestWithCredentials: false, // Browsers don't send cookies when fetching a manifest, enable this to fix that. `boolean`\n  manifestMaskable: false, // Maskable source image(s) for manifest.json. \"true\" to use default source. More information at https://web.dev/maskable-icon/. `boolean`, `string`, `buffer` or array of `string`\n  icons: {\n    // Platform Options:\n    // - offset - offset in percentage\n    // - background:\n    //   * false - use default\n    //   * true - force use default, e.g. set background for Android icons\n    //   * color - set background for the specified icons\n    //\n    android: true, // Create Android homescreen icon. `boolean` or `{ offset, background }` or an array of sources\n    appleIcon: true, // Create Apple touch icons. `boolean` or `{ offset, background }` or an array of sources\n    appleStartup: true, // Create Apple startup images. `boolean` or `{ offset, background }` or an array of sources\n    favicons: true, // Create regular favicons. `boolean` or `{ offset, background }` or an array of sources\n    windows: true, // Create Windows 8 tile icons. `boolean` or `{ offset, background }` or an array of sources\n    yandex: true, // Create Yandex browser icon. `boolean` or `{ offset, background }` or an array of sources\n  },\n  shortcuts: [\n    // Your applications's Shortcuts (see: https://developer.mozilla.org/docs/Web/Manifest/shortcuts)\n    // Array of shortcut objects:\n    {\n      name: \"View your Inbox\", // The name of the shortcut. `string`\n      short_name: \"inbox\", // optionally, falls back to name. `string`\n      description: \"View your inbox messages\", // optionally, not used in any implemention yet. `string`\n      url: \"/inbox\", // The URL this shortcut should lead to. `string`\n      icon: \"test/inbox_shortcut.png\", // source image(s) for that shortcut. `string`, `buffer` or array of `string`\n    },\n    // more shortcuts objects\n  ],\n};\n\ntry {\n  const response = await favicons(source, configuration);\n\n  console.log(response.images); // Array of { name: string, contents: <buffer> }\n  console.log(response.files); // Array of { name: string, contents: <string> }\n  console.log(response.html); // Array of strings (html elements)\n} catch (error) {\n  console.log(error.message); // Error description e.g. \"An unknown error has occurred\"\n}\n```\n\nThe default sources are as follow (groupped by platform):\n\n```javascript\n{\n  \"android\": [\n    \"android-chrome-144x144.png\",\n    \"android-chrome-192x192.png\",\n    \"android-chrome-256x256.png\",\n    \"android-chrome-36x36.png\",\n    \"android-chrome-384x384.png\",\n    \"android-chrome-48x48.png\",\n    \"android-chrome-512x512.png\",\n    \"android-chrome-72x72.png\",\n    \"android-chrome-96x96.png\"\n  ],\n  \"appleIcon\": [\n    \"apple-touch-icon-1024x1024.png\",\n    \"apple-touch-icon-114x114.png\",\n    \"apple-touch-icon-120x120.png\",\n    \"apple-touch-icon-144x144.png\",\n    \"apple-touch-icon-152x152.png\",\n    \"apple-touch-icon-167x167.png\",\n    \"apple-touch-icon-180x180.png\",\n    \"apple-touch-icon-57x57.png\",\n    \"apple-touch-icon-60x60.png\",\n    \"apple-touch-icon-72x72.png\",\n    \"apple-touch-icon-76x76.png\",\n    \"apple-touch-icon-precomposed.png\",\n    \"apple-touch-icon.png\"\n  ],\n  \"appleStartup\": [\n    \"apple-touch-startup-image-1125x2436.png\",\n    \"apple-touch-startup-image-1136x640.png\",\n    \"apple-touch-startup-image-1242x2208.png\",\n    \"apple-touch-startup-image-1242x2688.png\",\n    \"apple-touch-startup-image-1334x750.png\",\n    \"apple-touch-startup-image-1536x2048.png\",\n    \"apple-touch-startup-image-1620x2160.png\",\n    \"apple-touch-startup-image-1668x2224.png\",\n    \"apple-touch-startup-image-1668x2388.png\",\n    \"apple-touch-startup-image-1792x828.png\",\n    \"apple-touch-startup-image-2048x1536.png\",\n    \"apple-touch-startup-image-2048x2732.png\",\n    \"apple-touch-startup-image-2160x1620.png\",\n    \"apple-touch-startup-image-2208x1242.png\",\n    \"apple-touch-startup-image-2224x1668.png\",\n    \"apple-touch-startup-image-2388x1668.png\",\n    \"apple-touch-startup-image-2436x1125.png\",\n    \"apple-touch-startup-image-2688x1242.png\",\n    \"apple-touch-startup-image-2732x2048.png\",\n    \"apple-touch-startup-image-640x1136.png\",\n    \"apple-touch-startup-image-750x1334.png\",\n    \"apple-touch-startup-image-828x1792.png\",\n    \"apple-touch-startup-image-1179x2556.png\",\n    \"apple-touch-startup-image-2556x1179.png\",\n    \"apple-touch-startup-image-1290x2796.png\",\n    \"apple-touch-startup-image-2796x1290.png\",\n    \"apple-touch-startup-image-1488x2266.png\",\n    \"apple-touch-startup-image-2266x1488.png\",\n    \"apple-touch-startup-image-1640x2360.png\",\n    \"apple-touch-startup-image-2360x1640.png\"\n  ],\n  \"favicons\": [\n    \"favicon-16x16.png\",\n    \"favicon-32x32.png\",\n    \"favicon-48x48.png\",\n    \"favicon.ico\"\n  ],\n  \"windows\": [\n    \"mstile-144x144.png\",\n    \"mstile-150x150.png\",\n    \"mstile-310x150.png\",\n    \"mstile-310x310.png\",\n    \"mstile-70x70.png\"\n  ],\n  \"yandex\": [\n    \"yandex-browser-50x50.png\"\n  ]\n}\n\n```\n\nYou can programmatically access Favicons configuration (icon filenames, HTML, manifest files, etc) with:\n\n```js\nimport { config } from \"favicons\";\n```\n\nBelow you will find a simple working example to generate an output. Amend the `src`, `dest`, `htmlBasename` and `configuration` constants to suit your own needs.\n\n```js\nimport favicons from \"favicons\";\nimport fs from \"fs/promises\";\nimport path from \"path\";\n\nconst src = \"./icon.svg\"; // Icon source file path.\nconst dest = \"./favicons\"; // Output directory path.\nconst htmlBasename = \"index.html\"; // HTML file basename.\n\n// Configuration (see above in the README file).\nconst configuration = {\n  path: \"/favicons\",\n  appName: \"My Great App\",\n  appShortName: \"Great App\",\n  appDescription: \"A great application to test itgalaxy/favicons.\",\n  // Extra options...\n};\n\n// Below is the processing.\nconst response = await favicons(src, configuration);\nawait fs.mkdir(dest, { recursive: true });\nawait Promise.all(\n  response.images.map(\n    async (image) =>\n      await fs.writeFile(path.join(dest, image.name), image.contents),\n  ),\n);\nawait Promise.all(\n  response.files.map(\n    async (file) =>\n      await fs.writeFile(path.join(dest, file.name), file.contents),\n  ),\n);\nawait fs.writeFile(path.join(dest, htmlBasename), response.html.join(\"\\n\"));\n```\n\n## Questions\n\n> Why are you missing certain favicons?\n\nBecause pure Javascript modules aren't available at the moment. For example, the [El Capitan SVG favicon](https://github.com/haydenbleasel/favicons/issues/61) and the [Windows tile silhouette ability](https://github.com/haydenbleasel/favicons/issues/58) both require [SVG support](https://github.com/haydenbleasel/favicons/issues/53). If modules for these task begin to appear, please jump on the appropriate issue and we'll get on it ASAP.\n\n## Thank you\n\n- [@haydenbleasel](https://github.com/haydenbleasel) for this great project.\n- [@phbernard](https://github.com/phbernard) for all the work we did together to make Favicons and RFG awesome.\n- [@addyosmani](https://github.com/addyosmani), [@gauntface](https://github.com/gauntface), [@paulirish](https://github.com/paulirish), [@mathiasbynens](https://github.com/mathiasbynens) and [@pbakaus](https://github.com/pbakaus) for [their input](https://github.com/google/web-starter-kit/pull/442) on multiple source images.\n- [@sindresorhus](https://github.com/sindresorhus) for his help on documentation and parameter improvements.\n- Everyone who opens an issue or submits a pull request to this repo :)\n\n## Contribution\n\nFeel free to push your code if you agree with publishing under the MIT license.\n\nWhen testing, don't forget to update snapshots whenever you edit them: `npm test -- -u`.\n\n## [License](LICENSE)\n","publish_time":1779953214194,"_cnpm_publish_time":1779953214194,"dist-tags":{"beta":"7.0.0-beta.1","latest":"7.3.1"}}