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 ¶
- func Archive(inFilePath string, writer io.Writer, progress ProgressFunc) error
- func CopyDir(src, dst string, blacklist []string) (err error)
- func CopyFile(src, dst string) (err error)
- func LinkOrCopyFile(src, dst string) (err error)
- func RemoveFromDir(dir string, blacklist []string) (err error)
- func WriteFileIfDifferent(filename string, data []byte, perm os.FileMode) (bool, error)
- func WriteYAMLFileIfDifferent(filename string, s interface{}, perm os.FileMode) (bool, error)
- type ProgressFunc
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 ¶
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 ¶
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 ¶
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 ¶
RemoveFromDir removes everything from the given dir, except items with blacklisted names
func WriteFileIfDifferent ¶
WriteFileIfDiffers writes data to file but avoids overwriting a file with the same contents. Returns true if existing file was updated.
Types ¶
type ProgressFunc ¶
ProgressFunc is the type of the function called for each archive file.