This commit is contained in:
Your Name
2025-12-29 12:28:54 -05:00
commit 85cc1a95b4
4 changed files with 6643 additions and 0 deletions
+6575
View File
File diff suppressed because it is too large Load Diff
+20
View File
@@ -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"
}
}
+33
View File
@@ -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}`)
})()
+15
View File
@@ -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"]
}