Quick helper for side projects
npm install @ashiknesin/helpers#### solveCaptcha
``javascript`
async solveCaptcha({
type: string, // Optional. Default is "image-to-text"
base64Image: string, // Base64-encoded image data
imageUrl: string, // URL of the image
apiKey: string, // 2Captcha API Key
waitUntilResponse: bool // Optional. Default is true
})
Solves a captcha using the 2Captcha service.
`js`
class paramStore {
async getParameter(name: string, options?: any): Promise<{ data: string, error: Error }>
async getParameters(names: string[], options?: any): Promise<{ data: { [name: string]: string }, error: Error }>
async getManyByPath(path: string, options?: any): Promise<{ data: { [name: string]: string }, error: Error }>
async get(param: string | string[], options?: any): Promise<{ data: any, error: Error }>
async set(name: string, value: string): Promise<{ data: any, error: Error }>
}
Provides a convenient interface to interact with AWS Systems Manager Parameter Store.
js
class dynamoDB {
// AWS DynamoDB Document Client instance
}
`$3
`js
class s3 {
async upload(key: string, body: any, options?: any): Promise<{ data: { filePath: string }, error: Error }>
async download(key: string, destination: string): Promise<{ data: { filePath: string }, error: Error }>
async remove(keys: string[]): Promise<{ data: { filePaths: string[] }, error: Error }>
async createSignedUrl(key: string, expiresIn: number): Promise<{ data: { signedUrl: string }, error: Error }>
}
`Provides utility functions for interacting with AWS S3.
$3
#### zipDirectory
`js
async zipDirectory(inputDirectory: string, outputZipPath: string): Promise
`Zips a directory into a specified zip file.
#### unzipDirectory
`js
async unzipDirectory(inputZipPath: string, outputDirectory: string): Promise
`Unzips a zip file into a specified directory.
$3
#### supabaseAdmin`js
const supabaseAdmin = createClient({
url: string,
key: string
})
`Creates an instance of the Supabase client for administrative purposes.
#### supabaseUploadFile
`js
async supabaseUploadFile(bucket: string, filePath: string, fileData: any): Promise
`
Uploads a file to the Supabase storage.#### supabaseDownloadFile
`js
async supabaseDownloadFile(bucket: string, filePath: string, destination: string): Promise
`Downloads a file from the Supabase storage.
Usage
`js
import {
solveCaptcha,
paramStore,
dynamoDB,
s3,
zipDirectory,
unzipDirectory,
supabaseAdmin,
supabaseUploadFile,
supabaseDownloadFile
} from 'captcha-solver';// Example usage
const captchaResult = await solveCaptcha({
base64Image: 'base64EncodedImageData',
apiKey: 'your2CaptchaApiKey'
});
const paramValue = await paramStore.getParameter('parameterName');
const s3SignedUrl = await s3.createSignedUrl('objectKey', 3600);
// ... (other examples)
``