Utilities to read files from the file system ๐
# npm
npm install read-from-fs
# yarn
yarn add read-from-fs
# pnpm
pnpm add read-from-fs
// schemas/index
import { readFromSyncGenerator } from "read-from-fs";
const readFromHere = readFromSyncGenerator(__dirname);
export const myFirstSchema = readFromHere("schema.graphql");
export const my2Schema = readFromHere("2.graphql");
export const my3Schema = readFromHere("3.graphql");
By default it read the file as utf-8
but you can change that by
export const my3Schema = readFromHere("3.graphql", "ascii");
Add TSDocs with usage examples in the code. Check #1.
Check the API on ๐
Licensed under the MIT License.