mirror of
https://github.com/morten-olsen/mini-loader.git
synced 2026-02-08 01:36:26 +01:00
19 lines
319 B
TypeScript
19 lines
319 B
TypeScript
import { existsSync } from 'fs';
|
|
import { readFile } from 'fs/promises';
|
|
|
|
const path = process.env.INPUT_PATH;
|
|
const hasInput = path ? existsSync(path) : false;
|
|
|
|
const get = () => {
|
|
if (!hasInput || !path) {
|
|
return undefined;
|
|
}
|
|
return readFile(path, 'utf-8');
|
|
};
|
|
|
|
const input = {
|
|
get,
|
|
};
|
|
|
|
export { input };
|