@gorgonjs/file-provider
TypeScript icon, indicating that this package has built-in type declarations

1.5.1 • Public • Published

Gorgon File Provider

This library implements a file storage provider to @gorgonjs/gorgon, please refer to the documentation on https://gorgonjs.dev for full documentation.

Installation

npm install @gorgonjs/file-provider @gorgonjs/gorgon

yarn add @gorgonjs/file-provider @gorgonjs/gorgon

pnpm add @gorgonjs/file-provider @gorgonjs/gorgon

Example Usage

import { Gorgon } from '@gorgonjs/gorgon';
import { FileProvider } from '@gorgonjs/file-provider';

// Create a new instance of the file provider
const fileCache = FileProvider(cachePath, { createSubfolder: false });

// Add the provider to the gorgon instance
Gorgon.addProvider('perm', fileCache);

// Call an API and cache the results forever
const x = await Gorgon.get(
  `tmdb/movie/${id}`,
  async () => {
    return axios.get(`${api}/movie/${id}${key}`);
  },
  { provider: 'perm', expiry: false },
);

Package Sidebar

Install

npm i @gorgonjs/file-provider

Homepage

gorgonjs.dev

Weekly Downloads

4

Version

1.5.1

License

MIT

Unpacked Size

858 kB

Total Files

16

Last publish

Collaborators

  • mikevalstar