create
input that reads a file as JSON.
npm i input-from-file-json
import { inputFromFileJSON } from "input-from-file-json";
await take(inputFromFileJSON, { filePath: "data.json" });
inputFromFileJSON
takes a single argument, filePath
, of type string
.
It reads the filePath
from disk and returns either:
-
Error
: If an error was caught reading or parsing the file -
unknown
: The result of runningJSON.parse
on the file's text contents
See create.bingo > Templating Engine > Runtime > Inputs for more documentation on Inputs.