Documentation ¶
Overview ¶
Package compress
- Version: 1.0.0
- Copyright (c) 2022. Pashifika *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
Package compress
- Version: 1.0.0
- Copyright (c) 2022. Pashifika *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
Package compress
- Version: 1.0.0
- Copyright (c) 2022. Pashifika *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
Package compress
- Version: 1.0.0
- Copyright (c) 2022. Pashifika *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
Package compress
- Version: 1.0.0
- Copyright (c) 2022. Pashifika *
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at *
- http://www.apache.org/licenses/LICENSE-2.0 *
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
Index ¶
Constants ¶
View Source
const DefaultArchiverRoot = "."
Variables ¶
View Source
var ( ErrUnknownEncoder = errors.New("unknown encoder") ErrUnknownArchiver = errors.New("unknown archiver file") ErrWriterNotSupport = errors.New("writer is not supported") // ErrDirIndexTooLarge is passed to panic if memory cannot be allocated to store data in a buffer. ErrDirIndexTooLarge = errors.New("DirIndex.slice: too large") )
Functions ¶
func RegisterDecoder ¶
func RegisterDecoder(decoder Decoder)
RegisterDecoder registers decoder. It should be called during init. Duplicate decoders by name are not allowed and will panic.
func RegisterEncoder ¶
func RegisterEncoder(encode Encoder)
RegisterEncoder registers encoder. It should be called during init. Duplicate decoders by name are not allowed and will panic.
Types ¶
type ArchiverFile ¶
type Decoder ¶
type Decoder interface { // Name is get Decoder name. Name() string // SetRootInfo is set archiver file info to Decoder. SetRootInfo(info os.FileInfo) // SetCharset option support(only work in zip). SetCharset(charset []encoding.Encoding, skipErr bool) // OpenReader open the archive specified by name and returns io.ReadCloser. // // * 7z / rar is support part files. OpenReader(path string) (fs.FS, error) // OpenReaderWithPassword will open the archive file specified by name using password as // the basis of the decryption key and returns io.ReadCloser. // // * 7z / rar is support part files. OpenReaderWithPassword(path, pwd string) (fs.FS, error) // GetDirEntries get the archive path entries (if you know). GetDirEntries(path string, n int) ([]fs.DirEntry, error) // Close closes the archive file, rendering it unusable for I/O. Close() error // Reset is reset Decoder memory cache. Reset() }
type DirIndex ¶
type DirIndex struct {
// contains filtered or unexported fields
}
func NewDirEntries ¶
func NewDirEntries() *DirIndex
type Encoder ¶
type Encoder interface { // Name is get Encoder name. Name() string SetCompressedExt(ext map[string]struct{}) // Create use encoder name to create new archive file Create(w io.Writer, entries []ArchiverFile) error // Close closes the archive file, writing it unusable for I/O. Close() error // Reset is reset Encoder memory cache. Reset() }
type FileSystem ¶
type FileSystem struct { Charset []encoding.Encoding SkipCharErr bool // contains filtered or unexported fields }
func (*FileSystem) Close ¶
func (fs *FileSystem) Close() error
func (*FileSystem) CreateArchiverFile ¶
func (fs *FileSystem) CreateArchiverFile(encode string, w io.Writer, entries []ArchiverFile) error
CreateArchiverFile save archiver entries to disk
func (*FileSystem) Open ¶
func (fs *FileSystem) Open(path string) (fs.FS, error)
Open cannot work with OpenWithPwd at the same time
func (*FileSystem) OpenWithPwd ¶
func (fs *FileSystem) OpenWithPwd(path, pwd string) (fs.FS, error)
OpenWithPwd cannot work with Open at the same time
Directories ¶
Path | Synopsis |
---|---|
Package _7zip * Version: 1.0.0 * Copyright (c) 2022.
|
Package _7zip * Version: 1.0.0 * Copyright (c) 2022. |
internal
|
|
std_zip
Package std_zip * Version: 1.0.0 * Copyright (c) 2022.
|
Package std_zip * Version: 1.0.0 * Copyright (c) 2022. |
Package rar * Version: 1.0.0 * Copyright (c) 2022.
|
Package rar * Version: 1.0.0 * Copyright (c) 2022. |
Package zip * Version: 1.0.0 * Copyright (c) 2022.
|
Package zip * Version: 1.0.0 * Copyright (c) 2022. |
Click to show internal directories.
Click to hide internal directories.