소스 검색

init

master
Your Name 1 일 전
커밋
85cc1a95b4
4개의 변경된 파일6643개의 추가작업 그리고 0개의 파일을 삭제
  1. 6575
    0
      package-lock.json
  2. 20
    0
      package.json
  3. 33
    0
      src/launcher.ts
  4. 15
    0
      tsconfig.json

+ 6575
- 0
package-lock.json
파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
파일 보기


+ 20
- 0
package.json 파일 보기

@@ -0,0 +1,20 @@
1
+{
2
+  "name": "snibbets",
3
+  "type": "module",
4
+  "version": "1.0.0",
5
+  "description": "",
6
+  "scripts": {
7
+    "start": "npm run clean && tsc && node build/launcher.js",
8
+    "clean": "rm -rf build log.txt"
9
+  },
10
+  "author": "",
11
+  "license": "ISC",
12
+  "dependencies": {
13
+    "@helia/json": "^5.0.3",
14
+    "@helia/strings": "^5.0.3",
15
+    "fs": "^0.0.1-security",
16
+    "helia": "^6.0.14",
17
+    "typescript": "^5.9.3",
18
+    "winston": "^3.19.0"
19
+  }
20
+}

+ 33
- 0
src/launcher.ts 파일 보기

@@ -0,0 +1,33 @@
1
+import { createHelia } from 'helia'
2
+import { json } from '@helia/json'
3
+import * as winston from 'winston'
4
+
5
+const logger = winston.createLogger({
6
+    level: 'info',
7
+    defaultMeta: { service: 'helia-test' },
8
+    transports: [
9
+        new winston.transports.Console({ level: 'debug' }),
10
+        new winston.transports.File({ filename: 'log.txt' }),
11
+    ],
12
+});
13
+
14
+
15
+(async()=>{
16
+    const helia = await createHelia()
17
+    logger.info('Helia node started. Peer ID: ' + helia.libp2p.peerId.toString())
18
+
19
+    const j = json(helia)
20
+
21
+    const jsonCid = await j.add({ message: 'IPFS test 0', timestamp: Date.now() })
22
+    logger.info('Added JSON, CID: ' + jsonCid.toString())
23
+
24
+    try {
25
+        logger.info("Announcing " + jsonCid)
26
+        await helia.routing.provide(jsonCid)
27
+    } catch (error: any) {
28
+        logger.error(String(error))
29
+        throw error
30
+    }
31
+
32
+    logger.info(`https://ipfs.io/ipfs/${jsonCid}`)
33
+})()

+ 15
- 0
tsconfig.json 파일 보기

@@ -0,0 +1,15 @@
1
+{
2
+  "compilerOptions": {
3
+    "target": "esnext",
4
+    "module": "esnext",
5
+    "noImplicitAny": true,
6
+    "removeComments": true,
7
+    "preserveConstEnums": true,
8
+    "outDir": "build",
9
+    "sourceMap": true,
10
+    "moduleResolution": "node",
11
+
12
+  },
13
+  "include": ["src/**/*"],
14
+  "exclude": ["**/*.spec.ts"]
15
+}

Loading…
취소
저장