项目作者: FaigerSYS

项目描述 :
Utilities for working with Phar archives in JavaScipt
高级语言: JavaScript
项目地址: git://github.com/FaigerSYS/PharUtils.js.git
创建时间: 2017-06-21T09:04:41Z
项目社区:https://github.com/FaigerSYS/PharUtils.js

开源协议:MIT License

下载


PharUtils.js

Utilities for working with Phar archives in JavaScipt


Dependencies

Soft dependencies


Usage

  • Loading Phar archive from contents
    1. // Phar contents as <string> or <Uint8Array>
    2. var phar = new PharUtils.Phar();
    3. phar.loadPharData(phar_contents);
  • Creating new Phar archive
    1. var phar = new PharUtils.Phar();
    2. phar.setStub('<?php echo "Works!" . PHP_EOL; __HALT_COMPILER();');
    3. phar.setSignatureType(PharUtils.SIGNATURE_SHA256);
  • Adding file to Phar archive
    1. // Phar object
    2. var new_file = new PharUtils.PharFile("myName.txt", "some_contents");
    3. phar.addFile(new_file);
  • Saving Phar archive to contents
    1. // Phar object
    2. var phar_contents = phar.savePharData();
  • Converting to Zip
    1. // Phar object
    2. var zip = PharUtils.PharZipConverter.toZip(phar);
    …and more! Just look at the source.

License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.