init
This commit is contained in:
Generated
+6575
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "snibbets",
|
||||
"type": "module",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"scripts": {
|
||||
"start": "npm run clean && tsc && node build/launcher.js",
|
||||
"clean": "rm -rf build log.txt"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@helia/json": "^5.0.3",
|
||||
"@helia/strings": "^5.0.3",
|
||||
"fs": "^0.0.1-security",
|
||||
"helia": "^6.0.14",
|
||||
"typescript": "^5.9.3",
|
||||
"winston": "^3.19.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import { createHelia } from 'helia'
|
||||
import { json } from '@helia/json'
|
||||
import * as winston from 'winston'
|
||||
|
||||
const logger = winston.createLogger({
|
||||
level: 'info',
|
||||
defaultMeta: { service: 'helia-test' },
|
||||
transports: [
|
||||
new winston.transports.Console({ level: 'debug' }),
|
||||
new winston.transports.File({ filename: 'log.txt' }),
|
||||
],
|
||||
});
|
||||
|
||||
|
||||
(async()=>{
|
||||
const helia = await createHelia()
|
||||
logger.info('Helia node started. Peer ID: ' + helia.libp2p.peerId.toString())
|
||||
|
||||
const j = json(helia)
|
||||
|
||||
const jsonCid = await j.add({ message: 'IPFS test 0', timestamp: Date.now() })
|
||||
logger.info('Added JSON, CID: ' + jsonCid.toString())
|
||||
|
||||
try {
|
||||
logger.info("Announcing " + jsonCid)
|
||||
await helia.routing.provide(jsonCid)
|
||||
} catch (error: any) {
|
||||
logger.error(String(error))
|
||||
throw error
|
||||
}
|
||||
|
||||
logger.info(`https://ipfs.io/ipfs/${jsonCid}`)
|
||||
})()
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "esnext",
|
||||
"module": "esnext",
|
||||
"noImplicitAny": true,
|
||||
"removeComments": true,
|
||||
"preserveConstEnums": true,
|
||||
"outDir": "build",
|
||||
"sourceMap": true,
|
||||
"moduleResolution": "node",
|
||||
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["**/*.spec.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user