@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/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
- data = source.read(before.st_size + 1)
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) != before.st_size or (before.st_size, before.st_mtime_ns, before.st_ctime_ns) != (after.st_size, after.st_mtime_ns, after.st_ctime_ns):
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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengamehq/cli",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "description": "Deploy browser games to OpenGame from the command line.",
5
5
  "keywords": [
6
6
  "opengame",