mirror of
https://github.com/criyle/go-judge.git
synced 2025-11-04 14:50:02 +08:00
- increase default tmpfs size to 128M - add /config to get file store path - remove memory only file store close #20
31 lines
430 B
Go
31 lines
430 B
Go
//go:build !linux
|
|
// +build !linux
|
|
|
|
package model
|
|
|
|
import (
|
|
"io"
|
|
"os"
|
|
)
|
|
|
|
func fileToByte(f *os.File) ([]byte, error) {
|
|
if _, err := f.Seek(0, 0); err != nil {
|
|
return nil, err
|
|
}
|
|
var s int64
|
|
if fi, err := f.Stat(); err != nil {
|
|
return nil, err
|
|
} else {
|
|
s = fi.Size()
|
|
}
|
|
c := make([]byte, s)
|
|
if _, err := io.ReadFull(f, c); err != nil {
|
|
return nil, err
|
|
}
|
|
f.Close()
|
|
return c, nil
|
|
}
|
|
|
|
func releaseByte(b []byte) {
|
|
}
|