You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: recorder.go
    path of file: ./repos/next-terminal/server/common/term
    
    the code of the file until where you have to start completion: package term

import (
	"encoding/json"
	"os"
	"time"

	"next-terminal/server/utils"
)

type Env struct {
	Shell string `json:"SHELL"`
	Term  string `json:"TERM"`
}

type Header
    
func NewRecorder(recordingPath, term string, h int, w int) (recorder *Recorder, err error) {
	recorder = &Recorder{}
	parentDirectory := utils.GetParentDirectory(recordingPath)
	if utils.FileExists(parentDirectory) {
		if err := os.RemoveAll(parentDirectory); err != nil {
			return nil, err
		}
	}

	if err = os.MkdirAll(parentDirectory, 0777); err != nil {
		return
	}

	var file *os.File
	file, err = os.Create(recordingPath)
	if err != nil {
		return nil, err
	}

	recorder.File = file

	header := &Header{
		Title:     "",
		Version:   2,
		Height:    h,
		Width:     w,
		Env:       Env{Shell: "/bin/bash", Term: term},
		Timestamp: int(time.Now().Unix()),
	}

	if err := recorder.WriteHeader(header); err != nil {
		return nil, err
	}

	return recorder, nil
}