Use less memory when opening very large files

This commit is contained in:
Zachary Yedidia
2017-04-29 14:12:00 -04:00
parent 47324aea97
commit b4dda8bad8
8 changed files with 69 additions and 36 deletions

View File

@@ -59,6 +59,12 @@ func Max(a, b int) int {
return b
}
func FSize(f *os.File) int64 {
fi, _ := f.Stat()
// get the size
return fi.Size()
}
// IsWordChar returns whether or not the string is a 'word character'
// If it is a unicode character, then it does not match
// Word characters are defined as [A-Za-z0-9_]