The API provides file compression and decompression functionality using a custom Huffman coding algorithm implemented in C++ with a API on Node.js.
- Architecture
- Quick launch
- Tech stack
- API Endpoints
- Request/Response Examples
- Error Handling
- Documentation for Core
To start, you need to install the dependencies
npm i | yarnAfter installing the dependencies, you need to build the project.
npm run build | yarn buildIf you want to run the api in CLI mode
Then run the startup script
npm start | yarn start- Node.js + Express
- TypeScript
- C
- C++
POST /compress
Request:
- Content-Type:
multipart/form-data - Body: File upload with field name
file
Response:
- Success: Binary file with
.huffextension - Error: JSON with error details
POST /decompress
Request:
- Content-Type:
multipart/form-data - Body:
.hufffile upload with field namefile
Response:
- Success: Original uncompressed file
- Error: JSON with error details
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
<file content here>HTTP/1.1 200 OK
Content-Disposition: attachment; filename="document.txt.huff"
Content-Type: application/octet-stream
<compressed binary data>{
"error": "No file uploaded",
"details": "Request must include a file"
}This software is distributed under the MIT license
