Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Catalog · How the catalog works
Anything · Lazarus or Delphi
Random projectRandom project

Snappy-decompressor-in-Pure-Pascal

Snappy decompressor in Pure Pascal

View on GitHub

Member rating

No ratings yet.

Sign in to rate this project.

README

Snappy decompressor in pure Pascal

Snappy decompressor in pure Pascal. Should work in most Delphi and Lazarus versions. No DLLs required or any non-standard libraries.

Usage example

Decoding TBytes:

pascal
var InData, OutData: TBytes;
    F: TFileStream;
    Str: String;
begin
  F := TFileStream.Create('test.Snappy', fmOpenRead);
  SetLength(InData, F.Size);
  F.Read(InData[0], F.Size);
  F.Free;

  OutData := SnappyDecode(InData);
  SetLength(Str, Length(OutData));
  Move(OutData[0], Str[1], Length(Str));

  Memo1.Lines.Add(Str);
end;

Decoding Streams:

pascal
var F,P: TFileStream;
begin
  F := TFileStream.Create('test.Snappy', fmOpenRead);
  P := TFileStream.Create('test.txt', fmCreate);

  SnappyDecodeStream(F, P);

  p.Free;
  F.Free;
end;