Store string giving in parameter into file on s3

@param $filePath
@param $content
@return
544209
public function saveContentToFile($filePath, $content)
	{
		return $this->s3Client->putObject([
			'Bucket' => $this->getBucket(),
			'Key' => $filePath,
			'Body' => $content
		]);
	}
27412
public static function openFile(/*string*/ $filePath, /*string*/ $mode) {
    return self::isFile($filePath) ? fopen($filePath, $mode, false) : false;
  }
1107694
private function addFromString($filename, $content)
    {
        $this->repository->addFromString($this->getInternalPath().$filename, $content);
    }
874237
function _storeContents( $filePath, $contents, $scope, $datatype, $mtime = false, $fname = false )
    {
        if ( $fname )
            $fname .= "::_storeContents($filePath, ..., $scope, $datatype)";
        else
            $fname = "_storeContents($filePath, ..., $scope, $datatype)";

        return $this->_protect(
            array( $this, '_storeContentsInner' ),
            $fname,
            $filePath,
            $contents,
            $scope,
            $datatype,
            $mtime,
            $fname
        );
    }
910846
public function store_destfile_from_string($content) {
        if ($record = $this->get_file_record()) {
            $fs = get_file_storage();
            $existing = $fs->get_file(
                $record['contextid'],
                $record['component'],
                $record['filearea'],
                $record['itemid'],
                $record['filepath'],
                $record['filename']
            );
            if ($existing) {
                $existing->delete();
            }
            $file = $fs->create_file_from_string($record, $content);

            $this->raw_set('destfileid', $file->get_id());
        }

        return $this;
    }
360342
public function save($filename, $content) {
        if ($this->driver) {
            return $this->driver->save($filename, $content);
        }

        return false;
    }
674560
public function withFileToSend($filePath, $attachmentName = null, $attachment = false)
    {
        if (!is_string($attachmentName)) {
            $basePath = basename($filePath);
        } else {
            $basePath = $attachmentName;
        }

        $this->file = $filePath;

        if ($attachment) {
            return $this->withHeader('Content-Description', 'File Transfer')
                ->withHeader('Content-Disposition', 'attachment; filename="' . $basePath . '"')
                ->withHeader('Content-Transfer-Encoding', 'binary');
        }

        return $this;
    }
1123662
public function getFileContent($filePath)
	{
		$result = $this->s3Client->getObject(array(
			'Bucket' => $this->getBucket(),
			'Key'    => $filePath,
		));

		return (string) $result['Body'];
	}
284261
public function create($filename, $content)
    {
        $filename = str::path($filename);

        $this->createDirectory(dirname($filename));

        return file_put_contents($filename, $content);
    }
226943
public function store(string $filePath = null, string $disk = null, string $writerType = null, $diskOptions = [])
    {
        $filePath = $filePath ?? $this->filePath ?? null;

        if (null === $filePath) {
            throw NoFilePathGivenException::export();
        }

        return $this->getExporter()->store(
            $this,
            $filePath,
            $disk ?? $this->disk ?? null,
            $writerType ?? $this->writerType ?? null,
            $diskOptions ?? $this->diskOptions ?? []
        );
    }
963431
public static function append(string $filename, string $content): int
    {
        return file_put_contents($filename, $content, FILE_APPEND);
    }
1167498
protected function createFile($filePath, $contents)
    {
        $this->createDirectory(dirname($filePath));
        
        if (is_file($filePath)) {
            // if (!$this->opt('force')) {
            $this->output->setDecorated(true);
            $this->output->writeln(sprintf(
                "<comment>file exists  <cyan>%s</cyan></comment>",
                $this->prettyPath($filePath)
            ));
                // return;
            // } else {
                // $this->output->writeln(sprintf(
                    // "<comment>overwriten  <cyan>%s</cyan></comment>",
                    // $filePath
                // ));
            // }
        } else {
            $this->output->writeln(sprintf(
                "<info>create  <cyan>%s</cyan></info>",
                $this->prettyPath($filePath)
            ));
            file_put_contents($filePath, $contents);
        }
        
    }
765297
private function putContent($file, $content)
    {
        $this->ensureExists(dirname($file));
        touch($file);

        return file_put_contents($file, serialize($content));
    }
1028445
public function save($filename, $content)
    {
        $this->logs[] = $content;
        $this->storage->save($filename, $content);

        return $this;
    }
23198
public function uploadString($name, $content, $contentType = 'text/plain')
    {
        $s3FileName = $this->getFilePathAndUniquePrefix() . $name;
        list($bucket, $prefix) = explode('/', $this->s3path, 2);

        $this->s3client->putObject([
            'Bucket' => $bucket,
            'Key' => (empty($prefix) ? '' : (trim($prefix, '/') . '/')) . $s3FileName,
            'ContentType' => $contentType,
            'ACL' => 'private',
            'ServerSideEncryption' => 'AES256',
            'Body' => $content,
        ]);

        return $this->withUrlPrefix($s3FileName);
    }
656598
protected function saveFile($filename, $content)
    {
        if (!file_exists(dirname($filename))
            && mkdir(dirname($filename), 0777, true) === false
        ) {
            throw new GeneratorException(
                sprintf(
                    "Could not create directory '%s'.",
                    dirname($filename)
                )
            );
        }

        if (file_put_contents($filename, $content) === false) {
            throw new GeneratorException(
                sprintf(
                    "Could not open '%s' for writing.",
                    $filename
                )
            );
        }

        return $this;
    }
656932
function save(filePath, content) {
    mkpath(PATH.dirname(filePath));
    fs.writeFileSync(filePath, content);
}