@k3000/store 1.1.5 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/architect.mjs +12 -5
- package/package.json +1 -1
package/architect.mjs
CHANGED
|
@@ -277,7 +277,11 @@ export class Entity {
|
|
|
277
277
|
|
|
278
278
|
readFileSync(name) {
|
|
279
279
|
|
|
280
|
-
|
|
280
|
+
const path = this.#storage.bufferDir + (this.#position + this.#positionSet[name])
|
|
281
|
+
|
|
282
|
+
if (!existsSync(path)) return Buffer.alloc(0)
|
|
283
|
+
|
|
284
|
+
return readFileSync(path)
|
|
281
285
|
}
|
|
282
286
|
|
|
283
287
|
buffer(value, name) {
|
|
@@ -344,14 +348,17 @@ export class Entity {
|
|
|
344
348
|
return buffer
|
|
345
349
|
}
|
|
346
350
|
|
|
347
|
-
textToBuffer(value
|
|
351
|
+
textToBuffer(value, name) {
|
|
348
352
|
|
|
349
353
|
const buffer = Buffer.alloc(TypeLen.text)
|
|
350
354
|
|
|
351
|
-
|
|
352
|
-
|
|
355
|
+
if (value) {
|
|
356
|
+
|
|
357
|
+
writeFileSync(this.#storage.bufferDir + (this.#position + this.#positionSet[name]),
|
|
358
|
+
typeof value === "string" ? value : String(value))
|
|
353
359
|
|
|
354
|
-
|
|
360
|
+
buffer[0] = 1
|
|
361
|
+
}
|
|
355
362
|
|
|
356
363
|
return buffer
|
|
357
364
|
}
|