https://github.com/DKMFzF/archiver-huffman-api
Archiver for file compression
https://github.com/DKMFzF/archiver-huffman-api
api archiver c cpp docker express rest ts wasm
Last synced: about 1 year ago
JSON representation
Archiver for file compression
- Host: GitHub
- URL: https://github.com/DKMFzF/archiver-huffman-api
- Owner: DKMFzF
- Created: 2025-07-01T07:08:42.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-02T21:33:03.000Z (about 1 year ago)
- Last Synced: 2025-07-02T22:29:33.064Z (about 1 year ago)
- Topics: api, archiver, c, cpp, docker, express, rest, ts, wasm
- Language: WebAssembly
- Homepage:
- Size: 8.27 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Archiver Huffman API
The API provides file compression and decompression functionality using a custom Huffman coding algorithm implemented in C++ with a Node.js interface.
## Table of Contents
- [Quick launch](#quick-launch)
- [Tech stack](#tech-stack)
- [API Endpoints](#api-endpoints)
- [Request/Response Examples](#requestresponse-examples)
- [Error Handling](#error-handling)
- [Documentation for Core](./src/core/README.md)
## Quick launch
To start, you need to install the dependencies
```bash
npm i | yarn
```
After installing the dependencies, you need to build the project.
```bash
npm run build | yarn build
```
After that, you need to reset the program core.
***To do this, you need to have cmake and makefile in global dependencies.*** If these dependencies are not present, follow the link and follow the assembly [instructions](./src/core/README.md).
```bash
chmod +x ./core-build.sh
./core-build.sh
```
Then run the startup script
```bash
npm start | yarn start
```
## Tech stack
- Node.js + Express
- TypeScript
- C
- C++
## API Endpoints
### Compress File
`POST /compress`
**Request:**
- Content-Type: `multipart/form-data`
- Body: File upload with field name `file`
**Response:**
- Success: Binary file with `.huff` extension
- Error: JSON with error details
### Decompress File
`POST /decompress`
**Request:**
- Content-Type: `multipart/form-data`
- Body: `.huff` file upload with field name `file`
**Response:**
- Success: Original uncompressed file
- Error: JSON with error details
## Request/Response Examples
### Compression Request
```http
POST /compress HTTP/1.1
Host: localhost:3000
Content-Type: multipart/form-data; boundary=multipart/form-data
Content-Disposition: form-data; name="file"; filename="document.txt"
Content-Type: text/plain
```
## Successful Response
```http
HTTP/1.1 200 OK
Content-Disposition: attachment; filename="document.txt.huff"
Content-Type: application/octet-stream
```
## Error Response
```json
{
"error": "No file uploaded",
"details": "Request must include a file"
}
```
## License
This software is distributed under the MIT license
## Author
- [Dkmfzf](https://github.com/DKMFzF)