package imagewriter

import (
	"net/http"
	"strconv"
)

func WriteImage(w http.ResponseWriter, buffer *[]byte, fileType string) error {
	w.Header().Set("Content-Type", fileType)
	w.Header().Set("Content-Length", strconv.Itoa(len(*buffer)))
	w.WriteHeader(http.StatusOK)

	_, err := w.Write(*buffer)
	return err
}
