mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-02-24 21:19:39 +01:00
* Adjust typescript types * adjust types * fix types in all helper files * Fix types * Migrate js files to ts files * Refactor to TS files * Rename extentions * Adjust imports * Fix builds * Update lockfile * Fix last typescript migration * Fix entry path @lucide/outline-svg * Fix types * add checkout step * format files * Format files
24 lines
650 B
TypeScript
24 lines
650 B
TypeScript
/* eslint-disable import/prefer-default-export */
|
|
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);
|
|
};
|