MCPcopy Create free account
hub / github.com/Script-Hub-Org/Script-Hub / loaddata

Method loaddata

env/env.js:124–142  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

122 }).catch(t => this.logErr(t))
123 }
124 loaddata() {
125 if (!this.isNode()) return {}
126 {
127 ;(this.fs = this.fs ? this.fs : require('fs')), (this.path = this.path ? this.path : require('path'))
128 const t = this.path.resolve(this.dataFile),
129 e = this.path.resolve(process.cwd(), this.dataFile),
130 s = this.fs.existsSync(t),
131 a = !s && this.fs.existsSync(e)
132 if (!s && !a) return {}
133 {
134 const a = s ? t : e
135 try {
136 return JSON.parse(this.fs.readFileSync(a))
137 } catch (t) {
138 return {}
139 }
140 }
141 }
142 }
143 writedata() {
144 if (this.isNode()) {
145 ;(this.fs = this.fs ? this.fs : require('fs')), (this.path = this.path ? this.path : require('path'))

Callers 2

getvalMethod · 0.45
setvalMethod · 0.45

Calls 2

isNodeMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected