Giter Club home page Giter Club logo

simplecache-1's Introduction

simplecache GoDoc

The simplecache package provides support for reading Chromium simple cache v6 or v7.

Learn more: http://www.chromium.org/developers/design-documents/network-stack/disk-cache/very-simple-backend

See the example_test.go for an example of how to read an image from cache in testdata.

This project also includes a tool to read the cache from command line, read this README.

Short cache format

The simple cache contains different files:

Filename Description
index Fake index file
#####_0 Data stream file
#####_1 Data stream file
#####_s Data stream file
index-dir/the-real-index The real index file

Fake index file format (index)

offset size value description
0 8 0x656e74657220796f Magic
8 4 7 Version
12 8 0x0 Padding

Real index file format (the-real-index)

Overview:

  • File header
  • Last write reason (starting v7)
  • Index table
  • Last modified

File header

The index file header (struct indexHeader) is 36 bytes in size and consists of:

offset size value description
0 4 Payload size
4 4 Payload CRC32
8 8 0x656e74657220796f Magic
16 4 7 Version
20 8 Number of entries
28 8 Cache size

Index table

The index table is an array of entries. An entry (struct indexEntry) is 24 bytes in size and consists of:

offset size value description
0 8 Hash
8 8 Last used
16 8 Size

Data stream file format (#####_0)

Overview:

  • File header
  • URL
  • Data stream (stream 1)
  • Stream EOF
  • HTTP headers (stream 0)
  • (optionally) the SHA256 of the URL
  • Stream EOF

File header

The index file header (struct entryHeader) is 20 bytes in size and consists of:

offset size value description
0 8 0xfcfb6d1ba7725c30 Magic
8 4 5 Version
12 4 URL length
16 4 URL MD5

Stream EOF

The separator (struct entryEOF) contains information about the stream above. It is 20 bytes in size and consists of:

offset size value description
0 8 0xf4fa6f45970d41d8 Magic
8 4 Flag
12 4 stream CRC32
16 4 stream size
Flag
value description
0
1 the stream has CRC32
2 the URL has SHA256
3 1 + 2

Data stream file format (#####_1)

Overview:

  • File header
  • URL
  • Data stream (stream 2)
  • Stream EOF

Data stream file format (#####_s)

Overview:

  • File header
  • many of the following:
    • Range header
    • Range data stream

File header

The index file header (struct entryHeader) is 20 bytes in size and consists of:

offset size value description
0 8 0xfcfb6d1ba7725c30 Magic
8 4 7 Version
12 4 URL length
16 4 URL MD5

Range header

The range header (struct sparseRangeHeader) contains information about the following range stream. It is 28 bytes in size and consists of:

offset size value description
0 8 0xeb97bf016553676b Magic
8 8 stream offset
16 8 stream size
24 4 stream CRC32

simplecache-1's People

Contributors

schorlet 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.