Skip to content

Latest commit

 

History

History
42 lines (26 loc) · 1.02 KB

README.md

File metadata and controls

42 lines (26 loc) · 1.02 KB

@cerbos/files

npm

Load Cerbos policies from YAML or JSON files.

Prerequisites

  • Node.js 18+

Installation

$ npm install @cerbos/files

Example usage

import { readDirectory, readPolicy, readSchema } from "@cerbos/files";

const policy = await readPolicy("path/to/policy.yaml");
// => { apiVersion: "api.cerbos.dev/v1", ... }

const schema = await readSchema("_schemas/path/to/schema.json");
// => { id: "path/to/schema.json", definition: "..." }

const { policies, schemas } = await readDirectory("path/to/directory");
// => { policies: [...], schemas: [...] }

For more details, see the package documentation.

Further reading

Get help