@cerbos/files
TypeScript icon, indicating that this package has built-in type declarations

0.2.10 • Public • Published

@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

Package Sidebar

Install

npm i @cerbos/files

Weekly Downloads

4

Version

0.2.10

License

Apache-2.0

Unpacked Size

324 kB

Total Files

58

Last publish

Collaborators

  • ahaines
  • alexolivier
  • cerbosdev