{"id":16834843,"url":"https://github.com/dchest/fossil-delta-js","last_synced_at":"2025-03-17T04:32:38.113Z","repository":{"id":19766556,"uuid":"23024499","full_name":"dchest/fossil-delta-js","owner":"dchest","description":"Fossil SCM delta compression in JavaScript","archived":false,"fork":false,"pushed_at":"2024-04-06T11:02:55.000Z","size":71,"stargazers_count":71,"open_issues_count":0,"forks_count":7,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-27T18:01:24.275Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://dchest.github.io/fossil-delta-js/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dchest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-08-16T18:36:07.000Z","updated_at":"2025-02-24T00:54:21.000Z","dependencies_parsed_at":"2024-06-18T16:57:30.360Z","dependency_job_id":"3da08afe-2726-4bcd-8c13-2c698d677bfa","html_url":"https://github.com/dchest/fossil-delta-js","commit_stats":{"total_commits":45,"total_committers":2,"mean_commits":22.5,"dds":0.06666666666666665,"last_synced_commit":"fbf59f556fa75d934609ee43ef1b08cad9a9a673"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dchest%2Ffossil-delta-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dchest%2Ffossil-delta-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dchest%2Ffossil-delta-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dchest%2Ffossil-delta-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dchest","download_url":"https://codeload.github.com/dchest/fossil-delta-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243841909,"owners_count":20356571,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T12:08:03.971Z","updated_at":"2025-03-17T04:32:37.827Z","avatar_url":"https://github.com/dchest.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Fossil SCM delta compression algorithm\n======================================\n\nThe cool thing about it is that plain text inputs generate plain text deltas\n(binary inputs, of course, may generate binary deltas).\n\n* [Format](http://www.fossil-scm.org/index.html/doc/tip/www/delta_format.wiki)\n* [Algorithm](http://www.fossil-scm.org/index.html/doc/tip/www/delta_encoder_algorithm.wiki)\n* [Original implementation](http://www.fossil-scm.org/index.html/artifact/d1b0598adcd650b3551f63b17dfc864e73775c3d)\n* [Demo](https://dchest.github.io/fossil-delta-js/)\n\nInstallation\n------------\n\n    $ npm install fossil-delta\n\nUsage\n-----\n\n```javascript\nimport { createDelta, applyDelta } from 'fossil-delta';\n```\n\n### createDelta(source, target) -\u003e delta\n\nReturns a delta from source to target.\n\n`source` and `target` must be a `Uint8Array` or an `Array` of bytes.\nThe same type will be returned.\n\n### applyDelta(source, delta[, opts]) -\u003e target\n\nReturns the target by applying the delta to the origin.\n\n`origin` and `delta` must be a `Uint8Array` or an `Array` of bytes.\nThe same type will be returned.\n\nThrows an error if the delta fails to apply (e.g., if it is corrupted).\n\nOptional argument `opts` can be:\n\n```javascript\n{\n    verifyChecksum: false\n}\n```\n\nto disable checksum verification (which is enabled by default.)\n\n### getDeltaTargetSize(delta) -\u003e size\n\nReturns the size of the target for this delta.\n\nThrows an error if it cannot read the size from the delta.\n\n\n## Strings\n\nA nice property of the Fossil Delta Encoding is that it produces pure plain text deltas\nif the source and target are plain text.\n\nTo simplify working with plain text strings, the library provides the following convenience functions,\nwhich automatically encode and decode strings using `TextEncoder` and `TextDecoder` before processing:\n\n* `createStringDelta(source: string, target: string): string`\n* `applyStringDelta(origin: string, delta: string, options?: Options): string`\n* `getStringDeltaTargetSize(delta: string): number`\n\nNote that `getStringDeltaTargetSize()` will return the size of the target string in UTF-8 bytes,\nnot characters (that is, it's not always equal to `string` length of the resulting target).\n\n\nDevelopment\n-----------\n\nI develop with Bun.\n\nTo build the library, run:\n\n    $ bun run build\n\nnpm, yarn will also work for building.\n\nTo run tests, run:\n\n    $ bun test\n\n\nMigration from v1.x.x\n---------------------\n\nfossil-delta.js is now an ES module and there is no minified version included.\n\nAPI renames:\n\n- `create` -\u003e `createDelta`\n- `apply` -\u003e `applyDelta`\n- `outputSize` -\u003e `getDeltaTargetSize`\n\nImportant: `createDelta` and `applyDelta` now return the same type as the input (`Uint8Array` if given `Uint8Array`, `Array` if given `Array`), instead of always returning an `Array`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdchest%2Ffossil-delta-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdchest%2Ffossil-delta-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdchest%2Ffossil-delta-js/lists"}