mirror of
https://github.com/hanzoai/extract-svc.git
synced 2026-10-30 18:36:53 +00:00
Document text extraction service. Drop-in replacement for Huly's rekoni — listens on :4004 and serves /v1/extract, /v1/extract/url, /v1/health. - Pure Go, no CGo, no shelled binaries - Format detection by magic bytes (filename ignored) - PDF via ledongthuc/pdf; DOCX/XLSX/PPTX via native ZIP+XML walk; HTML via x/net/html with script/style strip; RTF via small native parser; plain text and markdown pass-through - Bearer JWT auth against IAM JWKS (RS256/RS512), 10m cache - 25 MB streaming upload cap, distroless static runtime - Tests for every format (real fixtures in testdata/) Image OCR is out of scope for v0.1 and returns HTTP 415.
36 lines
509 B
Makefile
36 lines
509 B
Makefile
SHELL := /usr/bin/env bash
|
|
BIN := extract
|
|
PKG := github.com/hanzoai/extract/cmd/extract
|
|
|
|
.PHONY: build run dev test fmt lint tidy clean docker
|
|
|
|
build:
|
|
CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o $(BIN) $(PKG)
|
|
|
|
run: build
|
|
./$(BIN)
|
|
|
|
dev:
|
|
go run $(PKG)
|
|
|
|
test:
|
|
go test -race -cover ./...
|
|
|
|
fmt:
|
|
gofmt -w .
|
|
goimports -w . 2>/dev/null || true
|
|
|
|
lint:
|
|
golangci-lint run ./...
|
|
|
|
tidy:
|
|
go mod tidy
|
|
|
|
clean:
|
|
rm -f $(BIN)
|
|
|
|
docker:
|
|
docker build -t ghcr.io/hanzoai/extract:dev .
|
|
|
|
.DEFAULT_GOAL := build
|