mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-11-11 13:28:19 +00:00
75b55160aa
* chore: upgrade eslint to v9 latest with compatible lint deps Agent-Logs-Url: https://github.com/lucide-icons/lucide/sessions/f7c1f1b5-d213-4afa-91a8-b799a16397ec * Fix eslint config * Fix a lot of eslint errors * Fix eslint * Fix eslint errors * Fix eslint errors * Fix types * Fix eslint warning * Format code * Add eslint 10 * Remove unused vars * Update pnpm * Update deps --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
23 lines
600 B
TypeScript
23 lines
600 B
TypeScript
import fs from 'fs/promises';
|
|
import path from 'path';
|
|
|
|
/**
|
|
* Reads metadata for an icon or category
|
|
*
|
|
* @param {string} fileName
|
|
* @param {string} directory
|
|
* @returns {object} The metadata for the icon or category
|
|
*/
|
|
export const readMetadata = async (fileName: string, directory: string): Promise<unknown> => {
|
|
let metadataFileContent: string | Buffer = await fs.readFile(
|
|
path.join(directory, fileName),
|
|
'utf-8',
|
|
);
|
|
|
|
if (Buffer.isBuffer(metadataFileContent)) {
|
|
metadataFileContent = metadataFileContent.toString('utf-8');
|
|
}
|
|
|
|
return JSON.parse(metadataFileContent);
|
|
};
|