txt-fyi-api
v1.0.0
Published
A Node.js package for txt.fyi
Readme
txt.fyi Utility Functions
Overview
This package provides two main functions for interacting with txt.fyi:
sendsession: Posts new text content to txt.fyi and returns the URL SLUG as session IDgetsession: Retrieves existing text content from txt.fyi using session ID
Installation
# Install
npm install txt-fyi-api
# Import the functions in your project
import sendsession from "txt-fyi-api";
import getsession from "txt-fyi-api";Usage Examples
Posting Content
const postExample = async () => {
try {
const result = await sendsession("Hello, World!");
if (result.success) {
console.log(`Post URL: https://txt.fyi/${result.output}`);
}
} catch (error) {
console.error('Failed to post:', error.message);
}
}Retrieving Content
const getExample = async () => {
try {
// Fetch content using a session ID
const content = await getsession("abc123");
console.log('Retrieved content:', content);
} catch (error) {
console.error('Failed to retrieve content:', error.message);
}
}