bsdiff 0.1.0

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new79

BSDiff #

pub package

Binary diff/patch algorithm based on bsdiff 4.3 by Colin Percival. It's very effective at compressesing incremental changes in binaries.

This implementation has the following differences from Colin's code, to make it easier to read and apply patches in Java and Objective C:

  • Using gzip instead of bzip2 because gzip is included in JDK by default
  • Using big- instead of little-endian serialization to simplify Java code
  • Using two's complement instead of high-bit coding for negatives numbers

Usage #

To use this package, add bsdiff as a dependency in your pubspec.yaml file.

Example #

Import the library via

import 'package:bsdiff/bsdiff.dart';

Then use the bsdiff and bspatch Dart functions in your code. To see how this is done, check out the example app.

0.1.0 #

  • Initial Open Source release.

example/main.dart

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Example script to illustrate how to use the bsdiff package to generate and apply patches.

import 'dart:typed_data';

import 'package:bsdiff/bsdiff.dart';

void main() async {
  final Uint8List originalData = Uint8List.fromList(List.generate(1000, (index) => index));
  final Uint8List modifiedData = Uint8List.fromList(List.generate(2000, (index) => 2 * index));

  print('Original data size ${originalData.length} bytes');
  print('Modified data size ${modifiedData.length} bytes');

  final Uint8List generatedPatch = bsdiff(originalData, modifiedData);
  final Uint8List restoredData = bspatch(originalData, generatedPatch);

  print('Generated patch is ${generatedPatch.length} bytes');
  print('Restored data size ${restoredData.length} bytes');
}

Use this package as a library

1. Depend on it

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


dependencies:
  bsdiff: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:


import 'package:bsdiff/bsdiff.dart';
  
Version Uploaded Documentation Archive
0.1.0 Feb 22, 2019 Go to the documentation of bsdiff 0.1.0 Download bsdiff 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
59
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
79
Learn more about scoring.

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

  • Dart: 2.2.0
  • pana: 0.12.14

Platforms

Detected platforms: Flutter, other

Primary library: package:bsdiff/bsdiff.dart with components: io.

Health issues and suggestions

Document public APIs. (-1 points)

3 out of 3 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Format lib/bsdiff.dart.

Run dartfmt to format lib/bsdiff.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.1-dev.2.0 <3.0.0
Dev dependencies
test ^1.3.4