Uname:Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64

Base Dir : /var/www/html

User : gavin


403WebShell
403Webshell
Server IP : 68.183.124.220  /  Your IP : 216.73.217.137
Web Server : Apache/2.4.18 (Ubuntu)
System : Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64
User : gavin ( 1000)
PHP Version : 7.0.33-0ubuntu0.16.04.16
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/gavin/workspace/happymandarin/node_modules/fobject/lib/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/gavin/workspace/happymandarin/node_modules/fobject/lib/index.js
// Generated by CoffeeScript 1.10.0
var File, fs, nodefn, path, semver,
  bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

fs = require('graceful-fs');

path = require('path');

nodefn = require('when/node');

semver = require('semver');

File = (function() {

  /**
   * @class
   * @name File
   * @param {String} path The path to the file. This will be resolved to an
     absolute path, so even if you change your cwd you can still access the same
     file.
   * @param {String} [options.base=./] Used for relative pathing. This will not
     be resolved to an absolute path. Typically where a glob starts.
   */
  function File(path1, options) {
    var ref;
    this.path = path1;
    if (options == null) {
      options = {};
    }
    this._processOptionsObject = bind(this._processOptionsObject, this);
    this.dirname = bind(this.dirname, this);
    this.extname = bind(this.extname, this);
    this.stat = bind(this.stat, this);
    this.unlink = bind(this.unlink, this);
    this.rename = bind(this.rename, this);
    this.append = bind(this.append, this);
    this.write = bind(this.write, this);
    this.read = bind(this.read, this);
    this._resolvePaths = bind(this._resolvePaths, this);
    this.base = (ref = options.base) != null ? ref : './';
    this._resolvePaths();
  }


  /**
   * Normalize & resolve paths. Call if the File.path changes
   * @function
   * @name _resolvePaths
   * @private
   */

  File.prototype._resolvePaths = function() {
    this.path = path.resolve(this.base, this.path);
    return this.relative = path.relative(this.base, this.path);
  };


  /**
   * Read from the file
   * @function
   * @name read
   * @param {String|null} [options.encoding=null]
   * @param {String} [options.flag='r']
   * @return {Promise}
   */

  File.prototype.read = function(options) {
    if (options == null) {
      options = {};
    }
    return nodefn.call(fs.readFile, this.path, this._processOptionsObject(options));
  };


  /**
   * Write `data` to the file
   * @function
   * @name write
   * @param {String|Buffer} data
   * @param {String|null} [options.encoding='utf8'] ignored if data is a
     buffer
   * @param {Number} [options.mode=438] default is 0666 in Octal
   * @param {String} [options.flag='w']
   * @return {Promise}
   */

  File.prototype.write = function(data, options) {
    if (options == null) {
      options = {};
    }
    return nodefn.call(fs.writeFile, this.path, data, this._processOptionsObject(options));
  };


  /**
   * Append `data` to the file
   * @function
   * @name append
   * @param {String|Buffer} data
   * @param {String|null} [options.encoding='utf8'] ignored if data is a
     buffer
   * @param {Number} [options.mode=438] default is 0666 in Octal
   * @param {String} [options.flag='w']
   * @return {Promise}
   */

  File.prototype.append = function(data, options) {
    if (options == null) {
      options = {};
    }
    return nodefn.call(fs.appendFile, this.path, data, this._processOptionsObject(options));
  };


  /**
   * Rename the file
   * @function
   * @name rename
   * @param {String} newPath The new path for the file. Will be resolved
     relative to File.base.
   * @return {Promise}
   */

  File.prototype.rename = function(newPath) {
    newPath = path.resolve(this.base, newPath);
    return nodefn.call(fs.rename, this.path, newPath).then((function(_this) {
      return function() {
        _this.path = newPath;
        return _this._resolvePaths();
      };
    })(this));
  };


  /**
   * Delete the file
   * @function
   * @name unlink
   * @return {Promise}
   */

  File.prototype.unlink = function() {
    return nodefn.call(fs.unlink, this.path);
  };


  /**
   * Return a Stat object for the file
   * @function
   * @name stat
   * @return {Promise}
   */

  File.prototype.stat = function() {
    return nodefn.call(fs.stat, this.path);
  };


  /**
   * Get the extension of a file
   * @function
   * @name extname
   * @return {String}
   */

  File.prototype.extname = function() {
    return path.extname(this.path);
  };


  /**
   * Get the dirname of the file
   * @function
   * @name dirname
   * @return {String}
   */

  File.prototype.dirname = function() {
    return path.dirname(this.path);
  };


  /**
   * Determine if we're using the new version of the FS API that supports an
     options object.
   * @return {Boolean} True if the version is >= 0.10.0 (when the options object
     was introduced).
   */

  File.prototype._isOptionsObjectSupported = function() {
    return semver.gte(process.version, '0.10.0');
  };


  /**
   * The pre-v0.10.0 fs functions took a encoding parameter and no options
     object. This function deals with that difference.
   * @param {[type]} options [description]
   */

  File.prototype._processOptionsObject = function(options) {
    var length, optionNames;
    if (this._isOptionsObjectSupported()) {
      return options;
    } else {
      optionNames = Object.keys(options);
      length = optionNames.length;
      if (length === 0 || (length === 1 && optionNames[0] === 'encoding')) {
        return options.encoding;
      } else {
        throw new Error("Node version <= 0.10.0 only supports an encoding option. Called with " + (optionNames.join()));
      }
    }
  };

  return File;

})();

module.exports = File;

Youez - 2016 - github.com/yon3zu
LinuXploit