Coder Social home page Coder Social logo

add-to-ipfs's Introduction


web3.storage & moralis

Add a directory to web3.storage or moralis from an Action, and output it's IPFS Content ID.

Example usage

uses: moojok/add-to-ipfs@main
id: web3
with:
  web3_token: ${{ secrets.WEB3_TOKEN }}
  path_to_add: 'dist'
  file_name:  'test'

# "bafkreicysg23kiwv34eg2d7qweipxwosdo2py4ldv42nbauguluen5v6am"
- run: echo ${{ steps.web3.outputs.cid }}

# "https://w3s.link/ipfs/bafkreicysg23kiwv34eg2d7qweipxwosdo2py4ldv42nbauguluen5v6am"
- run: echo ${{ steps.web3.outputs.url }}

Inputs

path_to_add

Required The path the root directory of your static website or other content that you want to publish to IPFS.

file_name

Required File name that you want to publish to IPFS.

web3_token

Required API token for web3.storage or moralis

service

Default web3.storage

Service type either web3.storage or moralis to upload the path.

Show advanced options: wrap_with_directory, include_hidden, web3_api

wrap_with_directory

Default false

Should the path_to_add be wrapped in a diretory when creating the IPFS DAG. For most folks using this action the default of false is fine.

This is the opposite of the default that web3.storage uses, as this action is commonly used to add a directory that contains a static website to IPFS. In that case you want the path_to_add to become the root cid so you can host your site at https://<cid>.ipfs.w3s.link rather than https://<cid>.ipfs.w3s.link/<path_to_add>.

If you do want to capture the path_to_add path itself in the IPFS DAG then you want to set wrap_with_directory:true.

see: https://web3.storage/docs/reference/js-client-library#parameters

include_hidden

Default false

Should hidden files prefixed with a . be included when found in the path_to_add

see: https://github.com/web3-storage/files-from-path#filesfrompath

web3_api

Default https://api.web3.storage

Useful for testing against staging deployments by setting to the api origin of your choice.

Outputs

cid

The IPFS content ID for the directory on IPFS. e.g. bafkreicysg23kiwv34eg2d7qweipxwosdo2py4ldv42nbauguluen5v6am

url

The IPFS gateway URL for the directory e.g. https://w3s.link/ipfs/bafkreicysg23kiwv34eg2d7qweipxwosdo2py4ldv42nbauguluen5v6am

Contibuting

💌 Considerate contributions welcome!

The dist folder is commited to the repo as is the curious cultural norm with JS actions, as the repo is the delivery mechanism, so to spare some cycles for the user users, all the deps are bundled into a single /dist/index.js monolith.

add-to-ipfs's People

Contributors

codeowners-com[bot] avatar dependabot[bot] avatar ljmf00 avatar moojok avatar olizilla avatar vasco-santos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.