php.js
Version:
Use phpjs functions as required.
17 lines (14 loc) • 633 B
JavaScript
exports.file_get_contents=require("./file_get_contents");
exports.sha1=require("./sha1");
module.exports=function(){ return sha1_file.apply(exports,arguments) };
function sha1_file(str_filename) {
// discuss at: http://phpjs.org/functions/sha1_file/
// original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// depends on: file_get_contents
// depends on: sha1
// test: skip
// example 1: sha1_file('http://kevin.vanzonneveld.net/pj_test_supportfile_1.htm');
// returns 1: '40bd001563085fc35165329ea1ff5c5ecbdbbeef'
var buf = this.file_get_contents(str_filename);
return this.sha1(buf);
}