@opengamehq/cli 0.9.1 → 0.9.3
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/CHANGELOG.md +24 -0
- package/dist/cli.mjs +149 -149
- package/dist/preflight-worker.mjs +9 -9
- package/dist/runtime-builder.mjs +1 -1
- package/dist/safe-fs.py +14 -2
- package/package.json +1 -1
package/dist/safe-fs.py
CHANGED
|
@@ -96,9 +96,21 @@ def execute(job, stream=None):
|
|
|
96
96
|
total += before.st_size
|
|
97
97
|
if total > job["maximum"]:
|
|
98
98
|
raise OverLimit("file limit")
|
|
99
|
-
|
|
99
|
+
span = job.get("range") if job["operation"] == "read-binary" else None
|
|
100
|
+
if span is None:
|
|
101
|
+
data = source.read(before.st_size + 1)
|
|
102
|
+
wanted = before.st_size
|
|
103
|
+
else:
|
|
104
|
+
# One part of a large asset: only these bytes reach memory, so a
|
|
105
|
+
# gigabyte goes up in parts without being held whole.
|
|
106
|
+
offset, wanted = span.get("offset"), span.get("length")
|
|
107
|
+
if (type(offset) is not int or type(wanted) is not int or offset < 0 or wanted < 0
|
|
108
|
+
or offset + wanted > before.st_size):
|
|
109
|
+
raise ValueError("invalid range")
|
|
110
|
+
source.seek(offset)
|
|
111
|
+
data = source.read(wanted)
|
|
100
112
|
after = os.fstat(source.fileno())
|
|
101
|
-
if len(data) !=
|
|
113
|
+
if len(data) != wanted or (before.st_size, before.st_mtime_ns, before.st_ctime_ns) != (after.st_size, after.st_mtime_ns, after.st_ctime_ns):
|
|
102
114
|
raise ValueError("file changed")
|
|
103
115
|
unchanged()
|
|
104
116
|
# Per-file ancestors are no longer needed once bytes are in memory.
|