404

[ Avaa Bypassed ]




Upload:

Command:

botdev@18.220.124.7: ~ $
/**
 * Module dependencies.
 */

var crypto = require('crypto');
var Readable = require('readable-stream');;
var dataUriToBuffer = require('data-uri-to-buffer');
var NotModifiedError = require('./notmodified');
var debug = require('debug')('get-uri:data');

/**
 * Module exports.
 */

module.exports = get;

/**
 * Returns a Readable stream from a "data:" URI.
 *
 * @api protected
 */

function get (parsed, opts, fn) {
  var uri = parsed.href;
  var cache = opts.cache;

  // need to create a SHA1 hash of the URI string, for cacheability checks
  // in future `getUri()` calls with the same data URI passed in.
  var shasum = crypto.createHash('sha1');
  shasum.update(uri);
  var hash = shasum.digest('hex');
  debug('generated SHA1 hash for "data:" URI: %o', hash);

  // check if the cache is the same "data:" URI that was previously passed in.
  if (cache && cache.hash == hash) {
    debug('got matching cache SHA1 hash: %o', hash);
    fn(new NotModifiedError());
  } else {
    debug('creating Readable stream from "data:" URI buffer');
    var buf = dataUriToBuffer(uri, opts);
    var rs = new Readable();
    rs._read = read(buf);
    buf = null;
    rs.hash = hash;
    fn(null, rs);
  }
}

/**
 * Function that returns a Readable `_read` function implementation.
 *
 * @api private
 */

function read (buf) {
  return function (n) {
    this.push(buf);
    this.push(null);
    buf = null;
  };
}

Filemanager

Name Type Size Permission Actions
.github Folder 0755
node_modules Folder 0755
test Folder 0755
History.md File 3.58 KB 0644
README.md File 5.42 KB 0644
data.js File 1.38 KB 0644
file.js File 1.91 KB 0644
ftp.js File 3.1 KB 0644
http.js File 6.38 KB 0644
https.js File 310 B 0644
index.js File 1.83 KB 0644
notfound.js File 565 B 0644
notmodified.js File 598 B 0644
package.json File 3.7 KB 0644