ourio

package
v0.0.0-...-b44964e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Copyright (c) 2014-2019 Cesanta Software Limited All rights reserved

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.

Copyright (c) 2014-2019 Cesanta Software Limited All rights reserved

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.

Copyright (c) 2014-2019 Cesanta Software Limited All rights reserved

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.

Copyright (c) 2014-2019 Cesanta Software Limited All rights reserved

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

This section is empty.

Variables

This section is empty.

Functions

func Archive

func Archive(inFilePath string, writer io.Writer, progress ProgressFunc) error

Archive compresses a file/directory to a writer

If the path ends with a separator, then the contents of the folder at that path are at the root level of the archive, otherwise, the root of the archive contains the folder as its only item (with contents inside).

If progress is not nil, it is called for each file added to the archive.

func CopyDir

func CopyDir(src, dst string, blacklist []string) (err error)

CopyDir recursively copies a directory tree, attempting to preserve permissions. Source directory must exist, destination must either not exist or be a directory.

func CopyFile

func CopyFile(src, dst string) (err error)

CopyFile copies the contents of the file named src to the file named by dst. The file will be created if it does not already exist. If the destination file exists, all it's contents will be replaced by the contents of the source file. The file mode will be copied from the source.

If src is a symlink, dst will be a symlink with the same target as src.

func LinkOrCopyFile

func LinkOrCopyFile(src, dst string) (err error)

LinkOrCopyFile creates a copy of src at dst. If possible, it uses hard link as an optimization. If not, a full copy is performed (via CopyFile).

func RemoveFromDir

func RemoveFromDir(dir string, blacklist []string) (err error)

RemoveFromDir removes everything from the given dir, except items with blacklisted names

func WriteFileIfDifferent

func WriteFileIfDifferent(filename string, data []byte, perm os.FileMode) (bool, error)

WriteFileIfDiffers writes data to file but avoids overwriting a file with the same contents. Returns true if existing file was updated.

func WriteYAMLFileIfDifferent

func WriteYAMLFileIfDifferent(filename string, s interface{}, perm os.FileMode) (bool, error)

WriteFileIfDiffers writes s as YAML to file but avoids overwriting a file with the same contents. Returns true if the file was updated.

Types

type ProgressFunc

type ProgressFunc func(archivePath string) bool

ProgressFunc is the type of the function called for each archive file.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL