1 |
|
2 | var fs = require("fs")
|
3 |
|
4 | if (!Buffer.from) {
|
5 |
|
6 | Buffer.from = Buffer.allocUnsafe = function(arg, enc, len) {
|
7 | return new Buffer(arg, enc, len)
|
8 | }
|
9 | Buffer.allocUnsafe = function(len) {
|
10 | return new Buffer(len)
|
11 | }
|
12 | Buffer.alloc = function (len, fill, enc) {
|
13 | return new Buffer(len).fill(fill, enc)
|
14 | }
|
15 | }
|
16 |
|
17 | if (!fs.copyFileSync) {
|
18 |
|
19 | fs.copyFileSync = function(src, dest, mode) {
|
20 | fs.writeFileSync(dest, fs.readFileSync(src))
|
21 | }
|
22 | }
|
23 |
|
24 | if (!process.versions) {
|
25 | process.versions = {}
|
26 | if (process.iotjs) process.versions.iotjs = process.version
|
27 | }
|
28 |
|
29 | if (!process.hrtime) {
|
30 |
|
31 | process.hrtime = function(diff) {
|
32 | var now = (new Date()).getTime() * 1e-3
|
33 | , sec = Math.floor(now)
|
34 | , nano = Math.floor((now%1) * 1e9)
|
35 | if (diff) {
|
36 | sec -= diff[0]
|
37 | nano -= diff[1]
|
38 | if (nano < 0) {
|
39 | sec--
|
40 | nano += 1e9
|
41 | }
|
42 | }
|
43 | return [sec, nano]
|
44 | }
|
45 | }
|
46 |
|
47 | if (!Object.assign) {
|
48 | Object.assign = function(a) {
|
49 |
|
50 | var t,k,i=1,A=arguments,l=A.length
|
51 | for (; i<l; ) if (t=A[i++]) for(k in t) if(Object.prototype.hasOwnProperty.call(t,k)) {
|
52 | a[k]=t[k]
|
53 | }
|
54 | return a
|
55 | }
|
56 | }
|
57 |
|
58 |
|
59 | module.exports.version = process.versions.litejs = require("./package.json").version
|
60 | module.exports.server = require("./server")
|
61 | module.exports.log = require("./log")
|
62 | module.exports.log.debug(process.env.DEBUG)
|
63 |
|
64 |
|
65 |
|