https://github.com/guru322/txt-fyi-api
https://github.com/guru322/txt-fyi-api
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/guru322/txt-fyi-api
- Owner: Guru322
- License: mit
- Created: 2025-01-17T11:38:50.000Z (3 months ago)
- Default Branch: Guru
- Last Pushed: 2025-02-21T11:56:38.000Z (2 months ago)
- Last Synced: 2025-03-10T02:16:19.525Z (about 2 months ago)
- Language: JavaScript
- Size: 54.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# txt.fyi Utility Functions
[](https://github.com/Guru322/txt-fyi-api/actions/workflows/npm-publish.yml)
## 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 ID
- `getsession`: Retrieves existing text content from txt.fyi using session ID## Installation
```bash
# 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
```javascript
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
```javascript
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);
}
}
```