free-content-ai-writer
v1.0.1
Published
An AI-powered text generation package using a free AI Writer API
Downloads
5
Maintainers
Readme
Free Content AI Writer
Free Content AI Writer is an npm package that provides easy access to AI-powered text generation using a free AI Writer API.
Installation
npm install free-content-ai-writer
Usage
const FreeContentAIWriter = require('free-content-ai-writer');
const writer = new FreeContentAIWriter();
async function generateText() {
try {
const article = await writer.generate('article', 'The Future of AI');
console.log(article);
} catch (error) {
console.error('Error:', error);
}
}
generateText();
API
new FreeContentAIWriter()
Creates a new instance of the FreeContentAIWriter class.
generate(type, title)
Generates text based on the given type and title.
type
: The type of writing (e.g., 'article', 'poem', 'essay').title
: The title or topic of the writing.
Returns a Promise that resolves with the generated text.
Example
const FreeContentAIWriter = require('free-content-ai-writer');
const writer = new FreeContentAIWriter();
writer.generate('article', 'The Impact of Artificial Intelligence')
.then(content => console.log(content))
.catch(error => console.error('Error:', error));
Error Handling
The generate
method will throw an error if:
- Either
type
ortitle
is missing - There's an issue with the API request
Make sure to handle these errors in your code.
License
Author
JohnDev19