1.3.0 • Published 10 months ago

diskio-api v1.3.0

Weekly downloads
-
License
ISC
Repository
github
Last release
10 months ago

Diskio Client

An API client for diskio-server exposed with OpenAPI.

📦 Packages

📦 CommonJS

const { DiskioAPIClient } = require('diskio-api');

📦 ESM

import { DiskioAPIClient } from 'diskio-api';

📦 TypeScript

import { DiskioAPIClient } from 'diskio-api';

Instance

const client = new DiskioAPIClient('http://localhost:8080');

Health Check

Get information about the server

const response = await client.healthCheck();
console.log(response.data.response.diskio.size); // 10737418240

Upload

const file: File = new File(['Hello world!'], 'hello.txt');
const { response } = await client.upload([ file ]);
const path = response[0];

Download

const file = await client.download(path, type: 'arrayBuffer' | 'stream') // default download is 'arrayBuffer'
// Work with the file
console.log(typeof file) // 'arraybuffer' | 'stream'

Delete

await client.delete('/path/to/file');

📝 License

This project is licensed under the GNU AFFERO GENERAL PUBLIC LICENSE - see the LICENSE file for details

1.2.2

10 months ago

1.3.0

10 months ago

1.2.1

10 months ago

1.2.0

10 months ago

1.1.0

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago