Nest-Client-JS
is a JavaScript library for interacting with the Nest-Server file server. The library provides simple interfaces for uploading, deleting, and fetching files using REST API.
- Upload files with the ability to add a name and description.
- Delete files using the File ID.
- Fetch files with an option to display them inline or download them.
- Written in TypeScript for strong type support.
- Node.js v14 or higher.
- Nest-Server: The server must be running.
- Axios: Installed as part of the library.
You can install the library using npm or bun:
npm install nest-client-js
Or using bun:
bun add nest-client-js
import NestClient from "nest-client-js";
const client = new NestClient("http://localhost:3000");
const file = new File(["Hello, World!"], "example.txt");
const response = await client.upload(file, "example.txt", "Description for the file");
console.log(response);
const fileId = "your-file-id";
const response = await client.delete(fileId);
console.log(response);
const fileId = "your-file-id";
const response = await client.get(fileId, true); // Download the file
console.log(response);
To run the local Nest-Server:
-
Ensure Go is installed on your machine.
-
Clone the project:
git clone https://github.com/MyCloudNest/Nest-Server.git cd Nest-Server
-
Build and run the server:
go build -o nest-server ./nest-server
-
The server will now be running at
http://localhost:3000
.
Contributions are welcome! Open a Pull Request or an Issue on the Nest-Client-JS GitHub Repository.
Licensed under the MIT License.