Commit 761013fe authored by nanahira's avatar nanahira

fix

parent 0a0756a4
...@@ -122,9 +122,10 @@ class Replay ...@@ -122,9 +122,10 @@ class Replay
@fromBuffer: (buffer) -> @fromBuffer: (buffer) ->
reader = new ReplayReader buffer reader = new ReplayReader buffer
header = Replay.readHeader reader header = Replay.readHeader reader
lzmaBuffer = Buffer.concat [header.getLzmaHeader(), reader.readAll()] restBuffer = reader.readAll()
lzmaBuffer = Buffer.concat [header.getLzmaHeader(), restBuffer]
if header.isCompressed if header.isCompressed
decompressed = lzmaBuffer decompressed = restBuffer
else else
decompressed = Buffer.from lzma.decompress lzmaBuffer decompressed = Buffer.from lzma.decompress lzmaBuffer
reader = new ReplayReader decompressed reader = new ReplayReader decompressed
......
...@@ -180,12 +180,13 @@ ...@@ -180,12 +180,13 @@
} }
static fromBuffer(buffer) { static fromBuffer(buffer) {
var decompressed, header, lzmaBuffer, reader, replay; var decompressed, header, lzmaBuffer, reader, replay, restBuffer;
reader = new ReplayReader(buffer); reader = new ReplayReader(buffer);
header = Replay.readHeader(reader); header = Replay.readHeader(reader);
lzmaBuffer = Buffer.concat([header.getLzmaHeader(), reader.readAll()]); restBuffer = reader.readAll();
lzmaBuffer = Buffer.concat([header.getLzmaHeader(), restBuffer]);
if (header.isCompressed) { if (header.isCompressed) {
decompressed = lzmaBuffer; decompressed = restBuffer;
} else { } else {
decompressed = Buffer.from(lzma.decompress(lzmaBuffer)); decompressed = Buffer.from(lzma.decompress(lzmaBuffer));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment