func NewFileStream(filename string) (*FileStream, error) {
	f, err := os.Open(filename)
	if err != nil {
		return nil, err
	}
	info, err := f.Stat()
	if err != nil {
		f.Close()
		return nil, err
	}
	// Memory map the file insead of using read/write.
	data, err := mmap.Map(f, mmap.RDONLY, 0)
	if err != nil {
		f.Close()
		return nil, err
	}
	bs, err := NewByteStream(data)
	if err != nil {
		f.Close()
		return nil, err
	}
	return &FileStream{
		sType: FILE,
		info:  info,
		f:     f,
		bs:    bs,
	}, nil
}
// NewFileStream creates a new binary stream from a memory mapped file).
NewFileStream creates a new binary stream from a memory mapped file).
// NewFileStream creates a new binary stream from a memory mapped file ) .
func NewFileStream(filename string) (*FileStream, error) {
	f, err := os.Open(filename)
	if err != nil {
		return nil, err
	}
	info, err := f.Stat()
	if err != nil {
		f.Close()
		return nil, err
	}
	data, err := mmap.Map(f, mmap.RDONLY, 0)
	if err != nil {
		f.Close()
		return nil, err
	}
	bs, err := NewByteStream(data)
	if err != nil {
		f.Close()
		return nil, err
	}
	return &FileStream{
		sType: FILE,
		info:  info,
		f:     f,
		bs:    bs,
	}, nil
}
func NewFileStream ( filename string ) ( * FileStream , error ) { f , err := os . Open ( filename ) if err != nil { return nil , err } info , err := f . Stat ( ) if err != nil { f . Close ( ) return nil , err } data , err := mmap . Map ( f , mmap . RDONLY , 0 ) if err != nil { f . Close ( ) return nil , err } bs , err := NewByteStream ( data ) if err != nil { f . Close ( ) return nil , err } return & FileStream { sType : FILE , info : info , f : f , bs : bs , } , nil }
NewFileStream creates a new binary stream from a memory mapped file).
NewFileStream creates a new binary stream from a memory mapped file ) .
// Memory map the file insead of using read/write.