This repository houses a powerful file service that offers various functionalities. Below are the key features of this service:
Capture a screenshot of a website by providing the URL. Accessible through /v1/image
, the system will open the specified URL, take a screenshot, and provide the image URL.
curl -X POST -H "Content-Type: application/json" -d '{"url": "https://example.com"}' http://your-service-domain/v1/image
Generate a PDF from a given URL, similar to the screenshot feature. Accessible through /v1/pdf
.
curl -X POST -H "Content-Type: application/json" -d '{"url": "https://example.com"}' http://your-service-domain/v1/pdf
Upload PNG, JPG, JPEG, or SVG images using the /v1/upload
endpoint. The system will compress the uploaded image into WebP format.
curl -X POST -H "Content-Type: multipart/form-data" -F "file=@/path/to/your/image.jpg" http://your-service-domain/v1/upload
Convert an image from a URL, compress it, and provide it in WebP format through the /v1/convert-image
endpoint.
curl -X POST -H "Content-Type: application/json" -d '{"url": "https://example.com/image.jpg"}' http://your-service-domain/v1/convert-image
- Node.js v18.17.0
- TypeScript
- HTTP (Express)
- Cloud Storage (Minio)
- Docker
-
Clone the repository:
git clone https://github.com/ayocodingit/generator-file-service.git cd generator-file-service
-
Create a
.env
file based on.env.example
. -
Install dependencies:
npm install
npm run start:dev
npm run build
npm start
npm run lint
npm run lint:fix
npm test
docker build -f docker/Dockerfile -t your-image-name:tag .
docker run -p 3000:3000 your-image-name:tag
Adjust the port mapping according to your configuration.
Feel free to explore and utilize this versatile file service for your needs!