Write a new file.

@param string $path
@param string $contents
@param Config $config   Config object
@param bool $isPutFile

@return array|false false on failure file meta data on success
166750
public function write($path, $contents, Config $config, $isPutFile = false)
    {
        $auth = $this->getAuth();
        $token = $auth->uploadToken($this->bucket, $path);
        $params = $config->get('params', null);
        $mime = $config->get('mime', 'application/octet-stream');
        $checkCrc = $config->get('checkCrc', false);

        $upload_manager = $this->getUploadManager();

        if ($isPutFile) {
        	list($ret, $error) = $upload_manager->putFile($token, $path, $contents, $params, $mime, $checkCrc);
        } else {
        	list($ret, $error) = $upload_manager->put($token, $path, $contents, $params, $mime, $checkCrc);
        }

        if ($error !== null) {
            $this->logQiniuError($error);

            return false;
        } else {
            return $ret;
        }
    }
359528
public function write($path, $contents)
	{
		$path = Util::normalizePath($path);

		//$this->assertAbsent($path);

		return (bool) $this->adapter->write($path, $contents);
	}
872457
private function writeMeta(NodeInterface $file, $path, $contents, Config $config)
    {
        $content = $file->getNode('jcr:content');
        if (!$mimetype = $config->get('mimetype')) {
            if (is_string($contents)) {
                $mimetype = Util::guessMimeType($path, $contents);
            } else {
                $mimetype = null;
            }
        }
        $content->setProperty('jcr:mimeType', $mimetype);

        $type = 'file';
        $result = compact('mimetype', 'type', 'path');

        if ($encoding = $config->get('encoding')) {
            $result['encoding'] = $encoding;
            $content->setProperty('jcr:encoding', $encoding);
        }
        if($timestamp = $config->get('timestamp')) {
            $result['timestamp'] = $timestamp;
            $content->setProperty('jcr:lastModified', $timestamp);
        }

        return $result;
    }
258755
protected function writeObject($path, $content, array $metadata)
	{
		try {
			if (\is_resource($content)) {
				$id = $this->client->storeFile($content, $metadata);
			} else {
				$id = $this->client->storeBytes($content, $metadata);
			}
		} catch (MongoGridFSException $e) {
			return false;
		}

		$file = $this->client->findOne(['_id' => $id]);

		return $this->normalizeGridFSFile($file, $path);
	}
824454
public function writeStream($path, $resource, Config $config)
    {
        $options = $this->prepareUploadConfig($config);

        return $this->client->upload(
            $this->getBucket(),
            $path,
            stream_get_contents($resource, -1, 0),
            $options
        );
    }
263043
private static function createAndWriteFile(string $path, string $contents)
    {
        $fileHandle = fopen($path, 'wb');
        if ($fileHandle === false) {
            throw new \RuntimeException('The file "' . $path . '" could not be opened for writing.', 1519851153);
        }

        fwrite($fileHandle, $contents);
        fclose($fileHandle);
    }
625159
public function write($path, $contents, Config $config)
    {
        $overwrite = (bool)$config->get('disable_asserts');

        try {
            return $this->normalizeMetadata($this->api->upload($path, $contents, $overwrite));
        } catch (\Exception $e) {
            return false;
        }
    }
391649
public function write( $key, $contents ) {
		$filename = $this->prepare_write( $key );

		if ( $filename ) {
			return file_put_contents( $filename, $contents ) && touch( $filename );
		}

		return false;
	}
37762
public function write($path, $input)
    {
        $contents = (new ArraySerialiser())->serialise($input);

        return $this->put($path, "<?php


 return $contents;");
    }
1087331
public function writeStream($path, $resource, array $config = []) {
        return $this->getFileSystem()->writeStream($path, $resource, $config);
    }
851110
public function writeStream($path, $resource, Config $config)
    {
        $options = $this->getOptions($this->options, $config);
        $contents = stream_get_contents($resource);

        return $this->write($path, $contents, $config);
    }
1131000
public function update($path, $contents, Config $config)
    {
        return $this->writeObject($path, $contents, $config);
    }
234418
public function write($path, $contents, Config $config)
    {
        $location = $this->applyPathPrefix($path);
        $options = $this->getOptionsFromConfig($config);
        return $this->ossClient->putObject($this->bucket, $location, $contents, $options);
    }
425850
public function createFile($pathname, $contents) {

        if (strpos($pathname, '/') !== false) {
            $dirName = dirname($pathname);
            $this->createDirectory($dirName);
        }
        file_put_contents($pathname, base64_decode($contents));
    }
13917
public function writeStream($path, $resource, Config $config)
    {
        return $this->upload($path, $resource, $config);
    }
166062
public function write($path, $contents)
    {
        if ( ! FileKeeper::exists($dir = $this->getBasePath()))
        {
            FileKeeper::directory($dir);
        }

        FileKeeper::write($path, $contents);
    }
1318670
public function put($path, $contents)
    {
        $path = self::validatePath($path);
        $fullPath = $this->getMediaPath($path);
        return $this->getStorageDisk()->put($fullPath, $contents);
    }