保存至文件的设置
@param string $filePath 文件路径
@param string $fileMode 文件打开方式，默认w+
@return static
341212
public function saveFile($filePath, $fileMode = 'w+')
    {
        $this->saveFileOption['filePath'] = $filePath;
        $this->saveFileOption['fileMode'] = $fileMode;
        return $this;
    }
394257
public void setFilePath(String filePath)
    {
        //create a new file
        File fileInstance=null;
        if(filePath!=null)
        {
            fileInstance=new File(filePath);
        }
        
        //set file
        this.setFile(fileInstance);
    }
670081
public static String md5File(String filePath) {
        File file = StringKit.isBlank(filePath) ? null : new File(filePath);
        return md5File(file);
    }
647807
protected static function saveKeyFile(
        string $filePath,
        string $keyData
    ): bool {
        $saved = \file_put_contents(
            $filePath,
            Hex::encode(
                Halite::HALITE_VERSION_KEYS . $keyData .
                \sodium_crypto_generichash(
                    Halite::HALITE_VERSION_KEYS . $keyData,
                    '',
                    \SODIUM_CRYPTO_GENERICHASH_BYTES_MAX
                )
            )
        );
        return $saved !== false;
    }
1046026
public function writeFile($filePath = null, array $options = [])
    {
        $filePath = empty($filePath)
            ? $this->filePath
            : $filePath;

        $handle = (new File())->create($filePath);

        foreach ($this->getArrayCopy() as $key => $value) {
            if ( ! is_array($value)) {
                $list = [$key, $value];
            } else {
                $list = $value;
            }
            fputcsv($handle, $list);
        }

        return fclose($handle);
    }
1242375
public function write($filePath, $contents, $mode = 'wb')
    {
        if (false !== ($fp = $this->create($filePath, $mode))) {
            flock($fp, LOCK_EX);

            for ($result = $written = 0, $length = strlen($contents); $written < $length; $written += $result) {
                if (($result = fwrite($fp, substr($contents, $written))) === false) {
                    break;
                }
            }

            flock($fp, LOCK_UN);
            fclose($fp);

            return is_int($result);
        }

        return false;
    }
1027939
public function generateAlternative($filePath, array $format)
    {
        $image = $this->imagickFactory->create($filePath);
        $image = $this->resizeImage($format, $image);

        $pathInfo = pathinfo($filePath);
        $alternativePath = $pathInfo['dirname'] . DIRECTORY_SEPARATOR . time() . $pathInfo['basename'];
        $this->saveImage($alternativePath, $image, $format['compression_quality']);

        return $alternativePath;
    }
81245
public function setFile(string $filePath): self
    {
        IOExpect::isFile($filePath);
        IOExpect::isReadable($filePath);

        $this->file = $filePath;

        return $this;
    }
1362256
private function restoreFile($filePath)
    {
        try {
            for ($i = 0; $i < $this->_config->getHostRetryLimit(); ++$i) {
                /* We try an exclusive creation of the file. This is an atomic operation, it avoid locking mechanism */
                @fopen($filePath, 'x');

                if (false === $fileData = file_get_contents($filePath)) {
                    return null;
                }
                return $fileData;
            }
        } catch (\Exception $e) {
            return null;
        }

        return null;
    }
724460
public function save( $filePath ){
		$data	= array();
		foreach( $this->index() as $route ){
			$data[]	= array(
				'controller'	=> $route->getController(),
				'action'		=> $route->getAction(),
				'pattern'		=> $route->getPattern(),
				'method'		=> $route->getMethod(),
			);
		}
		return \FS_File_JSON_Writer::save( $filePath, $data, TRUE );
	}
766834
protected static function chmodPathRecursive($path, $dirMode, $fileMode)
    {
        $result = false;

        $dirMode = self::valueToOct($dirMode);
        $fileMode = self::valueToOct($fileMode);

        $finder = new Finder();
        // Folders first
        foreach ($finder->directories()->in($path) as $item) {
            $result = chmod($item->getRealPath(), $dirMode);
        }
        // Files next
        foreach ($finder->files()->in($path) as $item) {
            $result = chmod($item->getRealPath(), $fileMode);
        }

        return $result;
    }
350896
public function watermark(string $filePath)
    {
        if (! file_exists($filePath)) {
            throw new FileNotFoundException($filePath);
        }

        $this->addManipulation('watermark', $filePath);

        return $this;
    }
429196
public function setFilePath($filePath)
    {
        Assert::stringNotEmpty($filePath, 'The factory file path must be a non-empty string. Got: %s');

        $this->setDirectory(Path::getDirectory($filePath));
        $this->setFileName(Path::getFilename($filePath));

        return $this;
    }
1316498
public function createNewFile($mode = null)
    {
        if ($this->isAbsolute()) {
            if (is_null($mode)) {
                $mode = $this->defaul_permission;
            }

            if ($resource = fopen($this->getPathname(), 'x')) {
                fclose($resource);
                $this->chmod($mode);
                return true;
            }
            return false;
        } else {
            throw new FileException('Given file path is not a absolute path.');
        }
    }
242997
public static function unlockFile($filePath)
    {
        global $globals;
        
        if (isset($globals['file_locks'][$filePath]))
        {
            # This creates the file if it doesnt exist.
            fclose($globals['file_locks'][$filePath]);
            unset($globals['file_locks'][$filePath]);
        }
    }
717145
public function writeFile($path, $content, $mode = 0666)
    {
        $this->getFilesystem()->dumpFile($path, $content, $mode);

        return $this;
    }
544209
public function saveContentToFile($filePath, $content)
	{
		return $this->s3Client->putObject([
			'Bucket' => $this->getBucket(),
			'Key' => $filePath,
			'Body' => $content
		]);
	}