GithubHelp home page GithubHelp logo

javer / temporary-filesystem Goto Github PK

View Code? Open in Web Editor NEW

This project forked from romainneutron/temporary-filesystem

0.0 0.0 0.0 38 KB

Extension to Symfony Filesystem component to handle temporary files

License: Other

PHP 100.00%

temporary-filesystem's Introduction

TemporaryFilesystem

TemporaryFilesystem propose an API for temprary filesystem based on Symfony Filesystem Component.

Build Status

Usage

use Neutron\TemporaryFilesystem\TemporaryFilesystem;

$fs = TemporaryFilesystem::create();

API Examples :

CreateTemporaryDirectory

CreateTemporaryDirectory creates a temporary directory with an optional mode :

$tempDir = $fs->createTemporaryDirectory($mode = 0755);

CreateTemporaryFile

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

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

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.

License

Released under the MIT license

temporary-filesystem's People

Contributors

alexander-schranz avatar cb8 avatar jens1o avatar quingkhaos avatar romainneutron avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.