t3nma c527ad0803 [COMPOSER] Add new php-ffmpeg package | 4 years ago | |
---|---|---|
.. | ||
src | 4 years ago | |
tests | 4 years ago | |
.gitignore | 4 years ago | |
.travis.yml | 4 years ago | |
CHANGELOG.md | 4 years ago | |
LICENSE | 4 years ago | |
README.md | 4 years ago | |
composer.json | 4 years ago | |
phpunit.xml.dist | 4 years ago |
TemporaryFilesystem propose an API for temprary filesystem based on Symfony Filesystem Component.
use Neutron\TemporaryFilesystem\TemporaryFilesystem;
$fs = TemporaryFilesystem::create();
CreateTemporaryDirectory creates a temporary directory with an optional mode :
$tempDir = $fs->createTemporaryDirectory($mode = 0755);
CreateTemporaryFile creates an empty files in the temporary folder:
$fs->createTemporaryFile();
// return an empty temporary files with a "thumb-"
// prefix, '.dcm' as suffix and 'jpg' as extension
$fs->createTemporaryFile('thumb-', '.dcm', 'jpg');
CreateTemporaryFiles creates a set of empty files in the temporary folder:
// return an array of 5 path to temporary files
$fs->createTemporaryFiles(5);
// return an array of 5 path to empty temporary files with a "thumb-"
// prefix, '.dcm' as suffix and 'jpg' as extension
$fs->createTemporaryFiles(20, 'thumb-', '.dcm', 'jpg');
This method is useful when dealing with libraries which encode images depending on the filename extension.
CreateEmptyFile creates an empty file in the specified folder:
// return a path to an empty file inside the current working directory
$fs->createEmptyFile(getcwd());
// return a path to an empty file in the "/home/romain" directory. The file
// has "original." as prefix, ".raw" as suffix and "CR2" as extension.
$fs->createEmptyFile("/home/romain", 'original.', '.raw', 'CR2');
This method is particularly useful when dealing with concurrent process writing in the same directory.
Released under the MIT license