Export the package to a file and save it using the propietary NAK structure.
@param string $filename File name to export package.
541440
public function export(string $filename)
    {
        $zip = new CNabuZipBuilder();
        $unlink_files = array();

        if ($this->getObjectsCount() > 0) {
            $file = new CNabuXMLBuilder();
            $package = new CNabuXMLPackage($this->nb_customer);
            if ($this->nb_language_list->getSize() > 0) {
                $package->setXMLLanguageList(new CNabuXMLLanguageList($this->nb_language_list));
            }
            if ($this->nb_role_list->getSize() > 0) {
                $package->setXMLRoleList(new CNabuXMLRoleList($this->nb_role_list));
            }
            if ($this->nb_site_list->getSize() > 0) {
                $package->setXMLSiteList(new CNabuXMLSiteList($this->nb_site_list));
            }
            $file->addFragment($package);
            $file->create();
            $zip->addFragment(new CNabuZipStream($zip, 'data', 'package.xml', $file));
        }

        $zip->exportToFile($filename);

        foreach ($unlink_files as $filename) {
            unlink($filename);
        }
    }
786142
public function download($filename = 'backup.zip')
	{
		if ( ! preg_match('|.+?\.zip$|', $filename))
		{
			$filename .= '.zip';
		}

		$this->factory->helpers->load('download');
		$get_zip = $this->get_zip();
		$zip_content =& $get_zip;

		force_download($filename, $zip_content);
	}
1335286
public function save($filename, $charset = null)
    {
        $data = $this->getData();

        /*
        if ($charset === null) {
            $charset = $this->options['charset'];
        }

        */
        // UTF-8 : file_put_contents("file.txt", "\xEF\xBB\xBF" . $data);

        /*

            $data = file_get_contents($npath);
            $data = mb_convert_encoding($data, 'UTF-8', 'OLD-ENCODING');
            file_put_contents('tempfolder/'.$a, $data);

            Or alternatively, with PHP's stream filters:

            $fd = fopen($file, 'r');
            stream_filter_append($fd, 'convert.iconv.UTF-8/OLD-ENCODING');
            stream_copy_to_stream($fd, fopen($output, 'w'));
         *
         * mb_convert_encoding($data, 'UTF-8', 'auto');
         * mb_convert_encoding($data, 'UTF-8', mb_detect_encoding($data));
         */

        $ret = file_put_contents($filename, $data);
        if (!$ret) {
            throw new \Exception("Filename $filename cannot be written");
        }
    }
221826
public function sendToDisk($filename)
    {
        $filePath = self::getOutputPath($filename);
        $this->pImage->render($filePath);
        return $filePath;
    }
1369352
function Save($filename)
    {
        $result = @$this->domDoc->save($filename);
        
        if ($result === false)
            throw new \Exception("RSS Feed saviing to '$filename' failed");
        
        return $result;
    }
54055
public function save($filename)
    {
        $json = [];
        foreach ($this as $cookie) {
            if ($cookie->getExpires() && !$cookie->getDiscard()) {
                $json[] = $cookie->toArray();
            }
        }

        if (false === file_put_contents($filename, json_encode($json))) {
            // @codeCoverageIgnoreStart
            throw new \RuntimeException("Unable to save file {$filename}");
            // @codeCoverageIgnoreEnd
        }
    }
299894
public function toFile( $fileName ){
		$css	= FS_File_CSS_Converter::convertSheetToString( $this->sheet );
		return FS_File_Writer::save( $fileName, $css );
	}
630633
public function exportToFile(string $filename, string $password = NULL) {
        $status = openssl_pkey_export_to_file(
            $this->getHandle(),
            $filename,
            $password
        );
        if(!$status) {
            throw new RuntimeException(OpenSSL::getLastError());
        }
    }
725402
public function appendToFile($filename, $content)
    {
        $dir = dirname($filename);

        if (!is_dir($dir)) {
            $this->mkdir($dir);
        }

        if (!is_writable($dir)) {
            throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
        }

        if (false === @file_put_contents($filename, $content, FILE_APPEND)) {
            throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
        }
    }
102329
public static function save( $fileName, $data, $packetName = NULL )
	{
		if( $packetName === NULL )
			$wddx	= wddx_serialize_value( $data );
		else
			$wddx	= wddx_serialize_value( $data, $packetName );
		return FS_File_Writer::save( $fileName, $wddx );
	}
181256
protected function exportMarkup($filename)
    {
        $file = $this->getProject()->getProperty('project.basedir') . "/docs/" . $filename;
        file_put_contents($file, $this->markup);
    }
251340
public function setFileName( $fileName ){
		$this->fileName	= $fileName;
		$this->sheet	= self::load( $fileName );
	}
262333
public function save($strFilename) {
        if(file_exists($strFilename)) {
            unlink($strFilename);
        }
        
        $this->_objZip->addFromString('word/document.xml', $this->_documentXML);
        
        // Close zip file
        if($this->_objZip->close() === false) {
            throw new Exception('Could not close zip file.');
        }
        
        rename($this->_tempFileName, $strFilename);
    }
422457
public function save( $fileName = NULL )
	{
		if( empty( $fileName ) )
		{
			if( empty( $this->fileName ) )
				throw new Exception( 'No TAR file name for saving given' );
			$fileName = $this->fileName;
		}
		$this->generateZip();																		// Encode processed files into TAR file format
		return File_Writer::save( $fileName, $this->content );										//  write archive file
	}
1297576
public function outputWithHeaders($filename='worksheet')
    {
        $filename = preg_replace('/[^aA-zZ0-9\_\-]/', '', $filename);

        header("Content-Type: application/msexcel; charset=" . $this->encoding);
        header("Content-Disposition: inline; filename=\"" . $filename . ".xlsx\"");
        echo $this->__toString();
    }
311134
static function export($list, $filename = 'data', $separator = ',', $enclosure = '"')
    {
        header('Content-Type: text/csv; charset=utf-8');
        header('Content-Disposition: attachment; filename=' . $filename . '.csv');

        $writer = Writer::createFromPath('php://output', 'w');
        $writer->insertAll($list); //using an array
    }
343403
public function store($filename, $filext=DEFAULTS::EXTENSION)
    {	
      return FileHandler::save($filename, $this->data);
    }