• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

DigixGlobal/dijix: Digix's IPFS & JSON Immutable & eXtendable File F ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

DigixGlobal/dijix

开源软件地址:

https://github.com/DigixGlobal/dijix

开源编程语言:

JavaScript 100.0%

开源软件介绍:

Dijix

Digix's IPFS & JSON Immutable & eXtendable File Format

This project aims to make IPFS objects easier to view by processing files and creating a standardised JSON schema that includes metadata about the file and allows clients to more efficiently render them.

Overview

The system is designed for use in the Digix Proof of Asset system (and other future projects) that leverages IPFS for immutable storage. Dijix allows for painless reading and uploading of this data in-browser.

Dijix consists of:

  • A specification of standardised dijix objects and types
  • A core javascript library:
    • For processing raw files (input) and uploading dijix objects (and their payloads) to IPFS
    • Reading dijix objects, resolving linked objects and fetching their payloads from IPFS
  • A plugin system that handles the uploading and processing various dijix types
  • Hooks that allow for global transformations (such as encryption)
  • semantic-ui-react component libraries for rendering dijix types in-browser (TODO)

The entire dijix suite (except for react components) is supported in the browser, node and via a command line interface.

Dijix Objects

Dijix objects are JSON objects (uploaded to IPFS) with the following properties:

  • Nestable: Objects can be embedded or linked to each other (via IPFS hash)
  • Versionable: Objects can link to previous versions of themselves
  • Extendable: New types can inherit from other types and extend or override functionality
  • Transformable: Standardisation allows for global and type-specific processing (see below)

Dijix objects come with standard headers and a type-specific data schema. Here's an example:

{
  "type": "image",
  "created": 1505208269402,
  "schema": "0.0.1",
  "data": {
    "height": 250,
    "width": 940,
    "src": "QmPQkRRAryL8MHu8ERabQNVgHcsixnZDjzm3nuTW7Xq81n",
    "size": 100789,
    "mime": "image/jpeg",
    "thumbnails": {
      "64": "Qme4PHgc7Ecfddg268WYEBagsnc9skNntM9BKbqjzAkajU",
      "256": "QmW4FkWdzRjAnJSnwHWSMxu4mL6rqo5AyfB4b4yUQ1PQ9i",
      "512": "QmQSjeNksgWWK7Bvk9YtMomFZmVMNkGcwvEQNYqFmSdvFE"
    },
    "fileName": "banner.jpg"
  },
  "ipfsHash": "QmUdRPGRxtz3ww3mHZB6dd4qmbYvrFRbrUVKW5XApiWGKF"
}

Dijix Types

Middlewares

A middleware system will provide optional functionality when importing and/or reading dijix objects:

Usage

Node & Browser

Upload
import Dijix from 'dijix';
import DijixImage from 'dijix-image';
import DijixPDF from 'dijix-pdf';

const dijix = new Dijix({
  ipfsEndpoint: 'https://ipfs.infura.io:5001', // optional
  httpEndpoint: 'https://ipfs.infura.io/ipfs', // optional
  cache: true, // optional in-memory dijix object cache, defaults to true
  concurrency: 10, // optional
  requestTimeout: 1000, //optional
  types: [
    new DijixImage(),
    new DijixPDF(),
  ],
});

await dijix.create('image', { src: '/some/image.jpg', ...config }); // outputs dijix object
await dijix.create('pdf', { src: '/some/pdf.pdf', ...config }); // outputs dijix object
Fetch
// This returns the document if found within `requestTimeout` milliseconds
// otherwise logs the error
await dijix.failSafeFetch(ipfsHash);

For node and CLI, you'll need npm, node 8+ and cairo / libpng. See dijix-image for instructions.

CLI

$ npm install -g dijix dijix-image dijix-pdf

dijix create pdf ~/Desktop/Sample.pdf
processing page 0 of 1
{
  "type": "pdf",
  "created": 1505207437136,
  "schema": "0.0.1",
  "data": {
    "fileSize": 37545,
    "metaData": {},
    "pageCount": 1,
    "src": "QmSkA3k4ksCvJPP2fojXsW15GHa1AJwytLonJikKFvFA4R",
    "mime": "application/pdf",
    "fileName": "Sample.pdf",
    "name": "test",
    "pages": [
      "QmeFUkpXBMF29XvxpfQm58EprrAxDVMpMBGe5chTkjVS4r"
    ]
  },
  "ipfsHash": "QmUfzvU4Q1rsR8U9Ti3Wib2enUX2zuy7FAxY2RoQEQ79NT"
}

Test

To run node and browser tests:

npm run test

License

BSD-3-Clause




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
cawfree/thegraph-react: ⚛️ React bindings for helping build decentralized appl ...发布时间:2022-06-22
下一篇:
jeroen/ipfs: R bindings to IPFS发布时间:2022-06-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap