lzma 0.4.0+2

  • Readme
  • Changelog
  • Example
  • Installing
  • 65

package:lzma is a port of LZMA compression algorithm to Dart.

The source code is a manual translation from the original Java version found on the LZMA SDK.

How to use it? #

If you want to compress data then just call to the lzma.encode function, and for the reverse call lzma.decode:

import 'package:lzma/lzma.dart';

final input = <int>[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /*...,*/];
final compressed = lzma.encode(input);
final decompressed = lzma.decode(compressed);

Limitations #

  • Output data size is limited to 32 bits.

0.4.0+2 #

  • Release for Dart2.

0.4.0+1 #

  • Updated test dependency -> dev_dependency.

0.4.0 #

  • BREAKING CHANGE: Replacing public API with LzmaCodec and lzma instance.

0.3.0 - Jan 25, 2014 #

  • Updated README.md, LICENSE.txt and CHANGELOG.md

0.2.1 - Nov 09, 2013 #

  • Updated README.md

0.2.0 - Nov 08, 2013 #

  • Added List
  • Used fixnum package from pub, removed local package
  • Fixed sublist parameters, now end is exclusive
  • Removed annoying "There is no such operator '>>' in num" warning
  • Ready for Dart 1.0.0!

0.1.3 - Mar 25, 2013 #

  • Updated fixnum library
  • Removed deprecated List.fixedLength constructor
  • Changed List.getRange for sublist

0.1.2 - Feb 01, 2013 #

  • Pre-M3 update

0.1.1 - Jan 18, 2013 #

  • Fixed some README.md tags
  • Added licenses directory
  • Added CHANGES.md

0.1.0 - Jan 17, 2013 #

  • First Dart pub package release

example/example.dart

import 'dart:async';
import 'dart:io';

import 'package:lzma/lzma.dart';

Future main(List<String> args) async {
  if (args.length != 2) {
    print('Usage: compress input output');
    return;
  }

  final inFile = new File(args[0]);
  final outFile = new File(args[1]);

  final encoded = lzma.encode(await inFile.readAsBytes());
  await outFile.writeAsBytes(encoded);
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  lzma: ^0.4.0+2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:lzma/lzma.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
72
Health:
Code health derived from static analysis. [more]
58
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
60
Overall:
Weighted score of the above. [more]
65
Learn more about scoring.

We analyzed this package on Nov 22, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:lzma/lzma.dart.

Health suggestions

Fix lib/src/encoder.dart. (-20.99 points)

Analysis of lib/src/encoder.dart reported 47 hints, including:

line 42 col 17: Unnecessary new keyword.

line 45 col 14: Unnecessary new keyword.

line 49 col 11: Unnecessary new keyword.

line 52 col 11: Unnecessary new keyword.

line 55 col 11: Unnecessary new keyword.

Fix lib/src/decoder.dart. (-13.09 points)

Analysis of lib/src/decoder.dart reported 28 hints, including:

line 34 col 20: Unnecessary new keyword.

line 36 col 11: Unnecessary new keyword.

line 39 col 17: Unnecessary new keyword.

line 48 col 13: Unnecessary new keyword.

line 61 col 29: Unnecessary new keyword.

Fix lib/bench.dart. (-6.78 points)

Analysis of lib/bench.dart reported 14 hints, including:

line 6 col 13: Unnecessary new keyword.

line 7 col 13: Unnecessary new keyword.

line 8 col 13: Unnecessary new keyword.

line 9 col 13: Unnecessary new keyword.

line 10 col 13: Unnecessary new keyword.

Fix additional 5 files with analysis or formatting issues. (-10.36 points)

Additional issues in the following files:

  • lib/src/range.dart (8 hints)
  • lib/src/lz.dart (7 hints)
  • lib/lzma.dart (5 hints)
  • lib/src/stream.dart (1 hint)
  • lib/src/base.dart (Run dartfmt to format lib/src/base.dart.)

Maintenance suggestions

Package is getting outdated. (-20 points)

The package was last published 62 weeks ago.

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
fixnum >=0.9.0 <0.11.0 0.10.11
Dev dependencies
test ^1.3.0