diskio-api
v1.3.0
Published
An API Client for diskio-server
Downloads
399
Maintainers
Readme
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