Skip to content

ipfs-examples/helia-ts-node

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Helia logo

Running Helia with ts-node


Explore the docs · Report Bug · Request Feature/Example

Table of Contents

About The Project

Getting Started

Prerequisites

Make sure you have installed all of the following prerequisites on your development machine:

Installation and Running example

> npm install
> npm start

Usage

Note

Since Node 22 you can run .ts files directly with the --experimental-strip-types option (and --experimental-transform-types if enum support is required), and also require ESM modules that do not await promises at the top level so this tool is effectively no longer necessary.

ts-node is a TypeScript execution and REPL tool for running TypeScript files from the command line, similar to how you would run JavaScript files with node.js.

It gives the illusion of compilation-free code execution by using JIT compilation to turn your TypeScript code into JavaScript at runtime and is a useful development tool.

Because TypeScript outputs CommonJS by default, and Helia is written using more modern ECMAScript Modules it's necessary to override the default configuration ts-node uses.

Putting it all together

You can run ts code using ts-node:

> npx ts-node ./src/index.ts

Helia is running
PeerId: 12D3KooWMUv1MYSYrgsEg3ykfZ6nDZwaT72LtVCheRNhH15kzroz

That's it! You just ran an ESM-only module using ts-node with JIT compilation!

For more examples, please refer to the Documentation

Documentation

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the IPFS Project
  2. Create your Feature Branch (git checkout -b feature/amazing-feature)
  3. Commit your Changes (git commit -a -m 'feat: add some amazing feature')
  4. Push to the Branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Want to hack on IPFS?

The IPFS implementation in JavaScript needs your help! There are a few things you can do right now to help out:

Read the Code of Conduct and JavaScript Contributing Guidelines.

  • Check out existing issues The issue list has many that are marked as 'help wanted' or 'difficulty:easy' which make great starting points for development, many of which can be tackled with no prior IPFS knowledge
  • Look at the Helia Roadmap This are the high priority items being worked on right now
  • Perform code reviews More eyes will help a. speed the project along b. ensure quality, and c. reduce possible future bugs
  • Add tests. There can never be enough tests

About

Running Helia with ts-node

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors