Giter VIP home page Giter VIP logo

coco's Introduction

Coco

A library for creating self-extracting archives in Python.

Overview

Coco is a data serialization library specialized for creating self-extracting archives (SEAs), i.e. a compressed stream which includes the decoder. SEAs are useful for distributing highly compressed files with uncommon, bespoke or proprietary codecs. The library currently utilized pickle as the outermost serialization format, however this is subject to change.

Self-extracting Archives

A self-extracting archive is type of compressed file which also include the decompression program. A simple example would be an image compressed using LZW with an LZW decoder appended to the end of the file. The primary advantage of SEAs is that they allow for highly optimized domain specific compression while maintaining portability.

Security

One risk of SEAs is that they can essentially execute arbitrary code. The risk associated with decompressing an SEA is similar to the risk associated with running third party executables. For this reason, it's good practice to extract the data in a sandboxed environment.

Usage

Create a decoder/extractor.

import coco

@coco.decoder
def decode(data):
  # Decompression logic...

Create a self-extracting archive.

archive = coco.encode(data, decoder)

Extract the original data.

data = coco.decode(archive)

Installation

pip install coco

API

coco.encode(data: Data, decoder: Decoder) -> Data

Takes a compressed data stream and a decoder, returns a self-extracting archive.

coco.decode(data: Data) -> Data

Takes a self-extracting archive and returns an uncompressed data stream.

coco's People

Contributors

oelin avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.