{"id":29581635,"url":"https://github.com/distpub/dshell","last_synced_at":"2026-05-15T21:33:39.536Z","repository":{"id":57216720,"uuid":"326869231","full_name":"DistPub/dshell","owner":"DistPub","description":"Decentralized distribution browser action framework, build-in P2P network and IPFS storage.","archived":false,"fork":false,"pushed_at":"2023-06-21T13:40:37.000Z","size":4983,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-19T21:55:23.949Z","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/DistPub.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,"zenodo":null}},"created_at":"2021-01-05T02:56:17.000Z","updated_at":"2023-06-21T13:40:40.000Z","dependencies_parsed_at":"2025-07-19T20:41:47.614Z","dependency_job_id":null,"html_url":"https://github.com/DistPub/dshell","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/DistPub/dshell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DistPub%2Fdshell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DistPub%2Fdshell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DistPub%2Fdshell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DistPub%2Fdshell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DistPub","download_url":"https://codeload.github.com/DistPub/dshell/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DistPub%2Fdshell/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267998371,"owners_count":24178531,"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","status":"online","status_checked_at":"2025-07-31T02:00:08.723Z","response_time":66,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":"2025-07-19T20:12:46.057Z","updated_at":"2026-05-15T21:33:39.489Z","avatar_url":"https://github.com/DistPub.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dshell\nDecentralized distribution browser action framework, build-in P2P network and IPFS storage.\n\n# Install\n`npm install dshell`\n\n# Build\nNO NEED!\n\n`dshell` writen under `esm` module system, but the dependency part current not support `esm`, \nhence `dshell` contains pre-build(use browserify) `dep.bundle.min.js` file and port it to `esm` in `dep.js` file.\n\n# Usage\n\nInclude `dshell` dependency first, add below code to your html code:\n\n```\n\u003cscript src=\"/path/to/dshell/dep.bundle.min.js\"\u003e\u003c/script\u003e\n\nor use cdn\n\n\u003cscript src=\"https://cdn.jsdelivr.net/npm/dshell/dep.bundle.min.js\"\u003e\u003c/script\u003e\n```\n\nThen you can import in module script tag:\n \n```\n\u003cscript type=\"module\" about=\"main\"\u003e\n  import shell from '/path/to/dshell/dshell.js'\n  document.addEventListener('DOMContentLoaded', async () =\u003e {\n    await shell.init()\n    let response = await shell.exec({action: '/Ping'})\n    console.log(response.json()) // =\u003e 'pong'\n  })\n\u003c/script\u003e\n\nor use cdn\n\n\u003cscript type=\"module\" about=\"main\"\u003e\n  import shell from 'https://cdn.jsdelivr.net/npm/dshell/dshell.js'\n  document.addEventListener('DOMContentLoaded', async () =\u003e {\n    await shell.init()\n    let response = await shell.exec({action: '/Ping'})\n    console.log(response.json()) // =\u003e 'pong'\n  })\n\u003c/script\u003e\n```\n\n# Custom Shell Example\n\n```\nconst username = 'demo';\nconst db = (new datastoreLevel(`dshell/${username}`, { prefix: '' })).db;\nconst country = '/dns4/wrtc-star1.par.dwebops.pub/tcp/443/wss/p2p-webrtc-star/';\nconst simplePeerOptions = { trickle: true };\nconst my = new UserNode(db, username, country, simplePeerOptions);\nconst soul = new Soul(db, username);\nconst shell = new Shell(my, soul);\nconst peers = [];\nconst intervalCache = {};\n\nasync function beatPingPeer(id) {\n  await my.pingPeer(id)\n}\n\nfunction log(message) {\n  console.log(message)\n}\n\nfunction MeetPeer(id) {\n  log(`* Nice to meet ${id}`);\n\n  if (!peers.includes(id)) {\n    peers.push(id)\n    intervalCache[id] = window.setInterval(async () =\u003e await beatPingPeer(id), 3000);\n  }\n}\n\nfunction AwayPeer(id) {\n  log(`* Bay ${id}`);\n\n  const index = peers.indexOf(id);\n  if (index \u003e -1) {\n    peers.splice(index, 1);\n    window.clearInterval(intervalCache[id]);\n    delete intervalCache[id]\n  }\n}\nmy.on('user:online', MeetPeer);\nmy.on('user:offline', AwayPeer);\n\ndocument.addEventListener('DOMContentLoaded', async () =\u003e {\n  await db.put('welcome', 'shell');\n  db.db.codec.opts.valueEncoding = 'json';\n  await my.init();\n  window.addEventListener(\"unload\", async () =\u003e await my.vegetative());\n  await soul.init();\n  shell.install();\n  shell.installModule(\n    'https://cdn.jsdelivr.net/npm/dshell/actions/network.js',\n    'https://cdn.jsdelivr.net/npm/dshell/actions/dom.js',\n    'https://cdn.jsdelivr.net/npm/dshell/actions/utils.js',\n    'https://cdn.jsdelivr.net/npm/dshell/actions/soul.js',\n  );\n  \n  // add action should install before node awake\n  shell.installExternalAction(function Add(_, a, b) {\n    return a + b\n  });\n  await my.awake();\n});\n```\n\nOpen your page in different PC(or just different Chrome User tabs for simulation), \nthen try remote call:\n\n```\nconst remote = peers[0] // select a peer id from `peers`\nawait shell.exec(shell.action(true, {receivers: [remote]})\n  .zipArray([Array(10).fill(1), Array(10).fill(2)]) // =\u003e [[1, 2], ...]\n  .Add.PCollect // =\u003e [3, ...]\n  .Map // =\u003e 3\n  .Echo // =\u003e \"3\"\n  .Collect // =\u003e [\"3\", ...]\n  .zipArray([Array(10).fill(4)]) // =\u003e [[4, \"3\"]]\n  .buildExcel(['data', ['number', 'add result']]) // =\u003e blob file\n  .download({args:['demo.xlsx'], receivers: [my.id]}) // trigger download\n  .pushFile(['/tmp/demo.xlsx']) // upload to IPFS storage\n  .previewOffice({receivers: [my.id]})) // preview online\n```\n\n# API\n\ntodo","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistpub%2Fdshell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdistpub%2Fdshell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdistpub%2Fdshell/lists"}