{"id":18544739,"url":"https://github.com/131/castor","last_synced_at":"2026-01-04T14:04:51.688Z","repository":{"id":57194841,"uuid":"157351457","full_name":"131/castor","owner":"131","description":"Content addressable storage for nodejs","archived":false,"fork":false,"pushed_at":"2024-05-02T10:39:49.000Z","size":90,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-02-09T00:09:31.138Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/131.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":"2018-11-13T09:08:53.000Z","updated_at":"2024-05-02T10:39:52.000Z","dependencies_parsed_at":"2024-05-02T10:59:55.773Z","dependency_job_id":null,"html_url":"https://github.com/131/castor","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/131%2Fcastor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/131%2Fcastor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/131%2Fcastor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/131%2Fcastor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/131","download_url":"https://codeload.github.com/131/castor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238748029,"owners_count":19523886,"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-11-06T20:17:27.583Z","updated_at":"2025-10-29T00:31:31.268Z","avatar_url":"https://github.com/131.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Content addressable storage - castor\n\nAn ES7 [CAS designed](https://en.wikipedia.org/wiki/Content-addressable_storage) file storage for nodejs with a simple API and robust implementation.\n\n\u003cimg align=\"right\" alt=\"castor drawing\" src=\"https://raw.githubusercontent.com/131/castor/master/doc/castor.png\"/\u003e\n\n\n[![Build Status](https://github.com/131/castor/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/131/castor/actions/workflows/test.yml)\n[![Coverage Status](https://coveralls.io/repos/github/131/castor/badge.svg?branch=master)](https://coveralls.io/github/131/castor?branch=master)\n[![NPM version](https://img.shields.io/npm/v/castor.svg)](https://www.npmjs.com/package/castor)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT)\n[![Code style](https://img.shields.io/badge/code%2fstyle-ivs-green.svg)](https://www.npmjs.com/package/eslint-plugin-ivs)\n\n\n\n# API\n\n```\nconst Storage = require('castor');\n  // castor internal index file path\nvar store = new Storage('./some/path/index.json');\n\n  // return an *index* to write and fetch file into\nvar index = store.getIndex('medias');\n```\n\n\n## async Index.checkEntry(file_name, file_url, file_md5)\n```\n  // download, if needed, the requested file, store it in CAS and reference it into current index\n  // file_url can be an url.parse'd object\nawait index.checkEntry(\"some/storage/path/file.mp4\", \"http://remoteurl.com/20320930293\", \"[CURRENT_MD5]\");\n```\n\n\n## Index.get(file_name)\n```\n// retrieve a file information from current index\nindex.get(\"some/storage/path/file.mp4\") \n/* retrieve {\n  file_size : (an integer),\n  file_path : './some/path/00/1/[FULL_MD5]',\n  file_md5 : '[FULL_MD5]',\n }\n*/\n```\n\n## Index.send(req, res, next)\n```\n// expose an http/express middleware to delivers content from an existing path\nserver.use(index.send.bind(index)) // (req, res, next)\n```\n\n\n# Advanced usage\n\n## Storage.warmup\n```\n// move all existing (and non indexed files) files to CAS design\nawait store.warmup();\n```\n\n\n## Index.reset()\n```\n//reset a local index file_path =\u003e hash mapping (no files are deleted at this time)\nindex.reset();\n```\n\n\n## async Storage.purge()\n```\n//remove all unlinked file (files not referenced in any index) from storage folder\nawait storage.purge();\n```\n\n\n\n\n# References\n* [Content-addressable storage](https://en.wikipedia.org/wiki/Content-addressable_storage)\n\n# Credits \n* [idjem](https://github.com/idjem)\n* [131](https://github.com/131)\n* [beaver](https://fr.wikipedia.org/wiki/Castor_(genre)) drawing by [Lincung Studio](https://www.youtube.com/channel/UCeGDCpWeOQnP8S9l7jrWgWw)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F131%2Fcastor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F131%2Fcastor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F131%2Fcastor/lists"}