selfie icon indicating copy to clipboard operation
selfie copied to clipboard

python: `to_be_file`

Open nedtwigg opened this issue 1 year ago • 1 comments

This is different than to_match_disk. "MatchDisk" has a special file format, garbage-collection, lots of fancy features. to_be_file is only for a single binary facet, it writes the binary to disk unchanged.

The demo that this unlocks is AI image generation, where you can open the snapshot without any extra tooling. Jus ttsay to_be_file("test.jpg") and you can just open the file.

The beginning of it is here:

  • https://github.com/diffplug/selfie/blob/c757b1c0184f0263c3ea248f44ed1680c8e81c8d/jvm/selfie-lib/src/commonMain/kotlin/com/diffplug/selfie/guts/WriteTracker.kt#L106-L144

nedtwigg avatar Apr 29 '24 15:04 nedtwigg

  • [x] basic to_be_file implementation #366
  • [x] needs expect_selfie(actual: bytes) -> BinarySelfie
    • means BinaryFacet
  • [x] needs cache_selfie_binary
    • def cache_selfie_binary(to_cache: Cacheable[bytes]) -> CacheSelfieBinary[bytes]: ...
      def cache_selfie_binary(to_cache: Cacheable[T], roundtrip: CacheSelfie[T, bytes]) -> CacheSelfieBinary[T]: ...
      

nedtwigg avatar May 05 '24 06:05 nedtwigg

Implemented!

nedtwigg avatar Dec 16 '24 07:12 nedtwigg