betto_codec_cookiejar 0.1.0-dev.1 copy "betto_codec_cookiejar: ^0.1.0-dev.1" to clipboard
betto_codec_cookiejar: ^0.1.0-dev.1 copied to clipboard

Read and write data in the Cookie Jar format. The cookie jar format uses `%` to separate records. Each record is a just a value - a bag of text.

Codec for Cookie-Jar files. #

Format is described in TAOUP: Raymond, E., "The Art of Unix Programming", 2003, isbn:0-13-142901-9. An online version is available at: http://www.catb.org/~esr/writings/taoup/html/ch05s02.html

The cookie jar format uses % to separate records. Each record is a just a value - a bag of text.

The fortune application uses the cookie jar format:

A day for firm decisions!!!!!  Or is it?
%
A few hours grace before the madness begins again.
%
A gift of a flower will soon be made to you.

Usage #

See the example in example/main.dart.

The cookieJar.decode and cookieJar.encode functions are the primary entry points (much like json.decode and json.encode).

import 'package:betto_codec_cookiejar/betto_codec_cookiejar.dart'
    show cookieJar;

const input = """A day for firm decisions!!!!!  Or is it?
%
A few hours grace before the madness begins again.
%
A gift of a flower will soon be made to you.%% with a comment
""";

void main() {
  final decoded = cookieJar.decode(input);

  print('Decoded: \n');
  for (final (i, entry) in decoded.indexed) {
    print('Entry #$i: $entry');
  }

  print('---');
  final encoded = cookieJar.encode(decoded);
  print('Encoded: \n\n$encoded');

  print('---');
  print('Re-decoded: \n');
  for (final (i, entry) in cookieJar.decode(encoded).indexed) {
    print('Entry #$i: $entry');
  }
  print('---');
}
0
likes
160
points
32
downloads

Documentation

API reference

Publisher

verified publisherbettongia.com

Weekly Downloads

Read and write data in the Cookie Jar format. The cookie jar format uses `%` to separate records. Each record is a just a value - a bag of text.

Repository (GitHub)
View/report issues

License

Apache-2.0 (license)

Dependencies

betto_common

More

Packages that depend on betto_codec_cookiejar