An isomorphic TypeScript library of
utility functions for parsing and interacting with
twtxt.txt files.
These functions include:
This library can be installed in several different ways:
twtxt-lib.js file, either by
downloading it from the
git
repo, the
website, or doing a
git clone https://git.itsericwoodward.com/eric/twtxt-lib.git
and pulling it out of the dist-browser folder.
import { hashTwt, loadAndParseTwtxtFile } from "./twtxt-lib.js";
import { hashTwt, loadAndParseTwtxtFile } from "twtxt-lib";
Use the tabs to learn more.
Example parsed file from
/twtxt-demos/demo-hipster-twtxt.txt :
Copyright © 2026 Eric Woodward, released under the MIT License.
A function that takes the constituent parts of a “twt” and generates an extension-compatible hash for it.
A function that parses a twtxt file string, returning an object with information about the file and its owner (including hashes for each twt and any metadata in the file).
Pre-included examples:
/twtxt-demos/demo-hipster-twtxt.txt
/twtxt-demos/demo-pirate-twtxt.txt
/twtxt-demos/demo-sagan-twtxt.txt
Load
Note that CORS restrictions may limit the effectiveness of using this function from another domain.
An async function that fetches a twtxt.txt-compatible file from a URL and parses it into an object
Pre-included examples:
/twtxt-demos/demo-hipster-twtxt.txt
/twtxt-demos/demo-pirate-twtxt.txt
/twtxt-demos/demo-sagan-twtxt.txt
Note that CORS restrictions may limit the effectiveness of using this function from another domain.