Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@graphql-tools/load-files

Package Overview
Dependencies
Maintainers
3
Versions
637
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphql-tools/load-files

A set of utils for faster development of GraphQL tools

  • 5.0.1-alpha-7e5cce7.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created

What is @graphql-tools/load-files?

@graphql-tools/load-files is a utility package that allows you to load files from the file system, specifically for GraphQL schema and resolvers. It is part of the GraphQL Tools ecosystem and is designed to help you modularize your GraphQL code by loading multiple files and merging them into a single schema or resolver map.

What are @graphql-tools/load-files's main functionalities?

Load GraphQL Type Definitions

This feature allows you to load GraphQL type definitions from .graphql files. The `loadFilesSync` function synchronously loads all files matching the given pattern and returns an array of type definitions.

const { loadFilesSync } = require('@graphql-tools/load-files');
const typeDefs = loadFilesSync('**/*.graphql');
console.log(typeDefs);

Load Resolvers

This feature allows you to load resolver functions from JavaScript or TypeScript files. The `loadFilesSync` function synchronously loads all files matching the given pattern and returns an array of resolver objects.

const { loadFilesSync } = require('@graphql-tools/load-files');
const resolvers = loadFilesSync('**/*.{js,ts}');
console.log(resolvers);

Load Files Asynchronously

This feature allows you to load files asynchronously. The `loadFiles` function returns a promise that resolves to an array of loaded files, which can be useful for non-blocking operations.

const { loadFiles } = require('@graphql-tools/load-files');
(async () => {
  const typeDefs = await loadFiles('**/*.graphql');
  console.log(typeDefs);
})();

Other packages similar to @graphql-tools/load-files

FAQs

Package last updated on 13 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc