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

1.10.0 • Public • Published

@epilot/file-client

CI npm version bundle size License

Client library for epilot File API

Uses openapi-client-axios

Installation

npm install --save @epilot/file-client

Usage

import fs from 'fs';
import { getClient } from '@epilot/file-client';
const fileClient = getClient();

// get upload params
const uploadFileRes = await fileClient.uploadFile(null, { filename: 'document.pdf', mime_type: 'application/pdf' });
const uploadParams = uploadFileRes.data;

// upload file to S3
const file = fs.readFileSync('./document.pdf')
const uploadRes = await fileClient.put(
  uploadParams.upload_url,
  file, 
  { headers: { 'content-type': 'application/json' }}
);

// save file as an entity
const uploadParams = await fileClient.saveFile(
  null,
  { s3ref: uploadParams.s3ref, access_control: 'private' },
);

Documentation

https://docs.epilot.io/docs/files/file-api

Readme

Keywords

Package Sidebar

Install

npm i @epilot/file-client

Weekly Downloads

314

Version

1.10.0

License

MIT

Unpacked Size

79.6 kB

Total Files

11

Last publish

Collaborators

  • epilot.ernesto
  • thisisernesto
  • nadyehmad
  • karl.epilot
  • aleksandr.lapushkin
  • manikandan.subramanian
  • jakub.duras.epilot
  • mp-polarsquad
  • mateus.nardo
  • diogo.f.marques
  • praneetro
  • epilot-keremnalbant
  • rossepilot
  • kate.astrid
  • juan.villamizar
  • j.carneiro
  • sebas.sauer
  • wmolinari
  • vladcrishan
  • alexmarqs
  • mohammadjd
  • julian01
  • daniel-bot.epilot
  • a.kedia
  • sureshkumars
  • dusty48
  • paulo.henriques
  • mohannad7
  • epilot-dev-tools
  • nishugoel
  • sumanth.kanakala
  • anttiviljami
  • j.pinho