Skip to content

Archiver for file compression. The API provides file compression and decompression functionality using a custom Huffman coding algorithm implemented in C++ with a API on Node.js.

Notifications You must be signed in to change notification settings

DKMFzF/archiver-cpp-wasm-node

Repository files navigation

Archiver Huffman API

The API provides file compression and decompression functionality using a custom Huffman coding algorithm implemented in C++ with a API on Node.js.

Table of Contents

Architecture

Architecture

Quick launch

To start, you need to install the dependencies

npm i | yarn

After installing the dependencies, you need to build the project.

npm run build | yarn build

If you want to run the api in CLI mode

Then run the startup script

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

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>

Successful Response

HTTP/1.1 200 OK
Content-Disposition: attachment; filename="document.txt.huff"
Content-Type: application/octet-stream

<compressed binary data>

Error Response

{
  "error": "No file uploaded",
  "details": "Request must include a file"
}

License

This software is distributed under the MIT license

Author

About

Archiver for file compression. The API provides file compression and decompression functionality using a custom Huffman coding algorithm implemented in C++ with a API on Node.js.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published