func (node *Node) Encode(content []byte) (err error) {
	logp := "Encode"
	node.plainv = content
	node.lowerv = bytes.ToLower(content)
	switch node.ContentEncoding {
	case EncodingGzip:
		var buf bytes.Buffer
		gz := gzip.NewWriter(&buf)
		_, err = gz.Write(content)
		if err != nil {
			_ = gz.Close()
			return fmt.Errorf("%s: %w", logp, err)
		}
		err = gz.Close()
		if err != nil {
			return fmt.Errorf("%s: %w", logp, err)
		}
		node.Content = libbytes.Copy(buf.Bytes())
	default:
		node.Content = content
	}
	return nil
}
Encode compress and set the content of Node.
package memfs
import (
	"bytes"
	"compress/gzip"
	"encoding/base64"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"mime"
	"net/http"
	"os"
	"path"
	"path/filepath"
	"time"
	"github.com/shuLhan/share/lib/ascii"
	libbytes "github.com/shuLhan/share/lib/bytes"
)
var (
	errOffset = errors.New("Seek: invalid offset")
	errWhence = errors.New("Seek: invalid whence")
)
type Node struct {
	os.FileInfo
	http.File
	SysPath         string   
	Path            string   
	Content         []byte   
	ContentType     string   
	ContentEncoding string   
	Parent          *Node    
	Childs          []*Node  
	GenFuncName     string   
	name    string       
	modTime time.Time    
	mode    os.FileMode  
	size    int64        
	plainv  []byte       
	lowerv  []byte       
	off     int64        
}
func NewNode(parent *Node, fi os.FileInfo, maxFileSize int64) (node *Node, err error) {
	if fi == nil {
		return nil, nil
	}
	var (
		logp    = "NewNode"
		sysPath string
		relPath string
	)
	sysPath = filepath.Join(parent.SysPath, fi.Name())
	relPath = path.Join(parent.Path, fi.Name())
	node = &Node{
		SysPath: sysPath,
		Path:    relPath,
		name:    fi.Name(),
		modTime: fi.ModTime(),
		mode:    fi.Mode(),
		size:    fi.Size(),
		Parent:  parent,
	}
	node.generateFuncName(sysPath)
	if node.mode.IsDir() {
		node.size = 0
		return node, nil
	}
	if fi.Mode()&os.ModeSymlink != 0 {
		sysPath, err = filepath.EvalSymlinks(sysPath)
		if err != nil {
			return nil, fmt.Errorf("%s: %w", logp, err)
		}
		fi, err = os.Lstat(sysPath)
		if err != nil {
			return nil, fmt.Errorf("%s: %w", logp, err)
		}
		node.mode = fi.Mode()
		if node.mode.IsDir() {
			node.size = 0
			return node, nil
		}
		node.size = fi.Size()
	}
	err = node.updateContent(maxFileSize)
	if err != nil {
		return nil, fmt.Errorf("%s: %w", logp, err)
	}
	err = node.updateContentType()
	if err != nil {
		return nil, fmt.Errorf("%s: %w", logp, err)
	}
	return node, nil
}
func (node *Node) AddChild(child *Node) {
	if child.modTime.IsZero() {
		child.modTime = time.Now()
	}
	node.Childs = append(node.Childs, child)
	child.Parent = node
}
func (node *Node) Close() error {
	node.off = 0
	return nil
}
func (node *Node) Decode() ([]byte, error) {
	if len(node.ContentEncoding) == 0 {
		node.plainv = node.Content
		return node.plainv, nil
	}
	logp := "Decode"
	node.plainv = node.plainv[:0]
	if node.ContentEncoding == EncodingGzip {
		r, err := gzip.NewReader(bytes.NewReader(node.Content))
		if err != nil {
			return nil, fmt.Errorf("%s: %w", logp, err)
		}
		buf := make([]byte, 1024)
		for {
			n, err := r.Read(buf)
			if n > 0 {
				node.plainv = append(node.plainv, buf[:n]...)
			}
			if err != nil {
				if err == io.EOF {
					break
				}
				return nil, fmt.Errorf("%s: %w", logp, err)
			}
			buf = buf[0:]
		}
	}
	return node.plainv, nil
}